I’m trying to display only one category on my homepage here. To do this, I know I have to edit the index.php file but I have no idea why my code isn’t taking. In this case, the ID of the post category I want to display is “1”

Here’s the code (my edit is the last line):

<div class="row">
    <!-- Contains the loop of all posts -->
    <div class="col-md-8" id="post-container">
        <!-- Start the Loop. -->
 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
 <?php if (in_category('1')&& is_home()) continue; ?>

Any ideas?

DISCLAIMER: I am in no way fluent in php, I was just told that this should be an easy issue to resolve.

Read more here: Showing only one category on wordpress homepage


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: