Forums

List all items in category. (2 posts)

  1. Susan
    Member
    Posted 3 years ago #

    Hi, I would like to create two columns.

    In the left column have ALL the posts from a category listed.

    In the right hand column have 5 posts from the same category.

    When I click "older" or "newer" i would like the list to remain the same in the left column, and the 5 newer or older posts to be listed in the right column.

    I have the following code, but when I click older or newer the 5 posts remain the same. :(

    <div id="left">
    <?php
    query_posts('showposts=25');
    while (have_posts()) : the_post(); ?>
    "><?php the_title();?>
    <?php endwhile; ?>
    </div>

    <div id="right">
    <?php
    query_posts('showposts=5');
    while (have_posts()) : the_post(); ?>
    "><?php the_title();?>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>
    </div>

  2. stvwlf
    Member
    Posted 3 years ago #

    Hi

    You only want one regular WP query per page. Read this article on how to create a custom query loop
    http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/

    you also need to apply this logic to the custom query loop (you won't use query_posts in the custom loop, but a similar syntax, as per the article)

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
          query_posts("cat=1&paged=$paged"); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.