Support » Fixing WordPress » How to show list of posts in a category

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    Jmac1337

    (@jmac1337)

    Im using dailypost theme, it seems to be quite oddly made- not the usual coding design i am used to

    Michael

    (@alchymyth)

    Forum Moderator

    Im trying to display all of the posts that are in a category on one page.

    this is already something what a category archive page would do – without much coding, consider to use the plugin ‘page-links-to’ and link a page from the menu to a category archive page.

    or you could start with a page template;
    for example copy page.php, and save it as category21-page-template.php;
    replace the commented stuff with the necesssary code at the top;
    replace this line:
    get_template_part('content', 'page' ) ;
    with this code:

    <div id="content">
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=21&paged=$paged");
    if ( have_posts() ) : ?>
    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php endwhile; ?>
    <?php  wplook_content_nav( 'nav-below' ); ?>
    <?php endif; ?>
    </div><!-- #content -->
    <div class="clear"></div>

    example of the full category21-page-template.php: http://pastebin.com/QTZ0VxgF

    if you want to show all posts on one page, change the query to:

    query_posts("cat=21&posts_per_page=-1");
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to show list of posts in a category’ is closed to new replies.