Support » Fixing WordPress » Get Posts: Category

  • Resolved jonizen


    Hey guys,
    When looking at a post, I need it to bring up a list of only the posts in its category. Currently it lists all posts regardless of category.

    I’ve figured out how to make it static
    $postslist = get_posts(‘category_name=news’);

    I need it to be dynamic.

    Here is my relevant code

        $postslist = get_posts();
        foreach ($postslist as $post) :
       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php endforeach; ?>

    [moderated–bump removed. Please refrain from bumping as per Forum Rules]

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Get Posts: Category’ is closed to new replies.