Forums

[resolved] How to limit your posts? (2 posts)

  1. oo0Thomas0oo
    Member
    Posted 3 years ago #

    Hi,

    How can I limit my posts not using the reading settings and query_posts()? Because when I use query_posts (now I do), posts_nav_link() won't work (used in a page or category).

    My page code now ("Phones" at http://www.gadgeez.com):

    <?php get_header(); ?>

    <div id="contentwrapper"><div id="content">

    <div class="adsense_top"><?php include (TEMPLATEPATH . '/adsense_top.php'); ?></div>

    <?php query_posts('showposts=6&cat=5'); ?>
    <?php rewind_posts(); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <? if( $post->ID == 66 ) continue; update_post_caches($posts); ?>
    <?
    global $more;
    $more = 0;
    ?>

    <div class="post">
    <h2 class="postTitle">"><?php the_title(); ?></h2>
    <div class="postMeta">
    <span class="date"><?php the_time('M.d, Y') ?></span> in
    <span class="filed"><?php the_category(', '); ?></span>
    <span class="commentcount"><?php comments_popup_link('Leave a Comment', '1 Comment', '% Comments'); ?></span>
    </div>
    <div class="postContent"><?php the_content('[Read the rest of this entry...]'); ?></div>
    </div> <!-- Closes Post -->

    <?php endwhile; ?>

    <?php else : ?>

    <div class="post">
    <h2 class="center">Not Found</h2>
    <p class="center">Sorry, but you are looking for something that isn't here.</p>
    </div> <!-- Closes Post -->

    <?php endif; ?>

    <div id="nextprevious">
    <div class="left"><?php posts_nav_link('','','« previous entries') ?>  </div>
    <div class="right"><?php posts_nav_link('','next entries »','') ?></div>
    </div>

    </div></div> <!-- Closes Content -->

    <?php get_sidebar(); ?>

    <div class="cleared"></div>

    </div> <!-- Closes Main -->

    <?php get_footer(); ?>

    Thanx for helping me with this one!

    Thomas

  2. oo0Thomas0oo
    Member
    Posted 3 years ago #

    Problem solved using this:

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

    instead of this:

    <?php query_posts('showposts=6&cat=5'); ?>
    <?php rewind_posts(); ?>

    Thanx anyway!

    Thomas

Topic Closed

This topic has been closed to new replies.

About this Topic