1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to make a page show all posts within a category? - wordpress

Discussion in 'Blogging' started by aardanyul, May 11, 2009.

  1. aardanyul

    aardanyul BANNED BANNED

    Joined:
    Sep 16, 2008
    Messages:
    363
    Likes Received:
    114
    Does anyone know the code to make all the posts within a category show up on a certain page?
     
  2. K1w12k3

    K1w12k3 Junior Member

    Joined:
    Feb 13, 2009
    Messages:
    116
    Likes Received:
    393
    Home Page:
    Have a look at this page in the WP Codex - it explains how to use category templates.
    Code:
    http://codex.wordpress.org/Category_Templates
    You can create a copy of the index.php and create a custom page template that uses category functions in the loop to display only category related posts.
    Code:
    http://codex.wordpress.org/Template_Tags/in_category or
    http://codex.wordpress.org/Template_Tags/query_posts or
    http://www.wptransformer.com/wordpress-customization/how-to-use-wordpress-to-run-an-article-directory.html
     
    Last edited: May 11, 2009
  3. chrismccoy

    chrismccoy Newbie

    Joined:
    Jan 24, 2009
    Messages:
    20
    Likes Received:
    8
    Code:
    <?php query_posts('cat=3&showposts=10'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="blog-entry">
     <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
     <div class="post_content">
      <?php the_content(__('Read more...')); ?>
     </div> <!- close post content ->
     <div class="post-end-content">
       Posted in <?php the_category(', ') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> <?php edit_post_link('Edit','',''); ?>
     </div> 
    </div>
    <?php endwhile; else: ?>
     Sorry, but you are looking for something that isn‘t here.
    <?php endif; ?>
    </div>