Support » Plugins » Hacks » How to have posts with different categories, display posts on different pages

  • Hi WordPress people,

    I have created different categories and named them News, Blog, Articles, I have then created 3 Posts and assigned each post to a different category.

    What I want to do is display a single category on a page. This would display a list of all the posts within that category with a title, a bit of the text and a link to take it to a page which will show the full Post.

    Im not sure which template i need to copy and hack,

    Someone please help, google has not been good to me


Viewing 1 replies (of 1 total)
  • In the code below you’ll find ‘cat’ => 4, change the 4 to the category id. you can ge the category id if you hover over the category and look at the link at the bottom of your URL. I used this code:

    template name: articles

    <?php get_header(); ?>

    <div class=”container”>

    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    $args= array(
    ‘cat’ => 4,
    ‘paged’ => $paged

    /*<?php query_posts(‘cat=4’); PAGINATION DOES NOT WORK WITH THIS STANDARD CODE */

    if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>

    <h2>” title=”<?php the_title(); ?>”><?php the_title(); ?></h2>

    <div class=”entry”>

    <?php content(’25’); ?>

    </div><!–end entry–>

    </div><!–end post–>

    <div class=”hr”><span class=”hide”><hr /></span></div>

    <?php endwhile; ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php next_posts_link(‘« Older Entries’) ?></div>
    <div class=”alignright”><?php previous_posts_link(‘Newer Entries »’) ?></div>

    <?php else : ?>

    <div class=”post”>
    <h2><?php _e(‘Not Found’); ?></h2>

    <?php endif; ?>

    <div class=”clear”></div>

    </div><!–end container–>

    include(TEMPLATEPATH . ‘/sidebar_articles.php’);

    <div class=”clear”></div>

    include(TEMPLATEPATH . ‘/foot_panel.php’);

    <?php get_footer(); ?>

    Hope this helps anyone with the same issue.

Viewing 1 replies (of 1 total)
  • The topic ‘How to have posts with different categories, display posts on different pages’ is closed to new replies.