• Resolved jonizen

    (@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

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

    [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.