Hide Category From Being Displayed
-
I’ve found a recent problem with my theme and I don’t know how to fix it. What I want in https://kamigoroshi.net is for it to not display the Asides (category 38) on the latest post. What I have is 2 loops where the first loop displays the latest post and the next loop displaying the rest of the posts. In a nutshell this is how the first loop looks like:
<?php $feature_post = get_posts('numberposts=1'); ?> <?php if( $feature_post ) : ?> <?php foreach( $feature_post as $post ) : setup_postdata( $post ); ?> <?php $feature_post_id = $post->ID; ?> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> <?php the_excerpt(); ?> <?php endforeach; ?>
If I change the $feature_post to “query_posts(‘cat=-38’)&get_posts(‘numberposts=1’)”, it hides the category, it also doesn’t display any posts in the latest posts because it doesn’t call the previous post before the post in the excluded category.
Is there any way I can go about it? I really don’t know how to go about this.
Oh, before I forget, I took the structure from this link. The only think I did change was to remove the “category=” from “get_posts(‘numberposts=1’)”. Other than that, it’s all the same.
- The topic ‘Hide Category From Being Displayed’ is closed to new replies.