WordPress.org

Ready to get started?Download WordPress

Forums

Display All Posts in Category In a Page (3 posts)

  1. relaxedguy
    Member
    Posted 7 years ago #

    I have a page. I want to have the page display the full text of all posts in a particular category. Nowhere can I find how to do this.

    I guess I could make the page a category.php or category-#.php but I thought it would be easy enough to do a dynamic query along the lines of (pseudo code):

    query_posts('cat=thecategory');
    Output all posts in the specified category along with the title

    This can't be difficult. I have the "run PHP in post" plugin, which works fine.

    It seems like passing variables is the way to go, what's the Codex page and/or syntax for this? The ones I've seen don't let you specify a category to be displayed.

  2. StyledSheet
    Member
    Posted 7 years ago #

    <?php query_posts('showposts=10&cat=3'); if (have_posts()) : while (have_posts()) : the_post(); ?>
    	<?php the_content(); ?>
    <?php endwhile; else : endif; ?>
  3. relaxedguy
    Member
    Posted 7 years ago #

    Thanks Styled, exactly what I needed.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.