Forums

[resolved] Pagination Bar (3 posts)

  1. revlimiter
    Member
    Posted 3 years ago #

    I would prefer that the pagination bar does not display (at the bottom) for pages that return 9 or less search results. Here is an example of what I am talking about:

    http://www.kimstewart.ca/?s=test&submit.x=31&submit.y=13&submit=Search

    Does anybody know the PHP code to do this?
    "<?php if >9 posts"..."return null ?>" lol

    Any help is greatly appreciated!! :)
    Cheers,

  2. Chad Holden
    Member
    Posted 3 years ago #

    You could do a simple $x count.

    Use something like $x = 0;

    <?php $x = 0; while have_posts() : the_post() 
    
     ...
    $x++;
    endwhile; ?>

    then

    <?php if ($x>9) { ?>
    Navigation bar code here
    <?php } ?>

    That should work how you want it to.

  3. revlimiter
    Member
    Posted 3 years ago #

    hey chad,
    thanks for the code! i actually managed to get it to work using $postnum instead of $x

    <?php if ($postnum>9) { ?>
    <?php include (TEMPLATEPATH . '/navigation.php'); ?>
    <?php } ?>

    cheers,

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.