Current category within get_posts
I’m trying to show the posts from only the category I’m in at the time, now my code looks like this:
<?php global $post; $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> <?php endforeach; ?>
But that show all the posts within all categories. I just want to show the ones in the current category, without pointing at a specific category ID, because I have a lot of categories.
- The topic ‘Current category within get_posts’ is closed to new replies.