How to exclude parent and child categories
-
Hi,
I have a very very old WordPress site from which I need to exclude the parent and child categories until they are ready to make those posts available.
I have imported a long list of posts and meta information via a CSV file so all the posts are in the site whilst they are working on adding images etc.
Until we upgrade, this is how it needs to be but for now, I need to exclude the parent and child categories of the posts they just imported via this CSV.
I have looked through a number of solutions none of which are working.
This is my latest code…
<?php while (have_posts()) : the_post(); ?> <?php // here we exclude the parent and child categories. ?> <?php if (!in_category('157')) { ?> <div class="post"> <h1 id="post-<?php the_ID(); ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> </h1> <div class="descr"> <?php if(is_category() || is_archive()) { the_content(); } else { the_content(); } ?> </div> </div> <?php } ?> <?php endwhile; ?> <div class="left"><?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?></div> <div class="clearer"><span></span></div> <?php else : ?> <h2 class="center">Not Found</h2> <?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php endif; ?>
Many thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to exclude parent and child categories’ is closed to new replies.