Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

hey guys, i know there is something like if ( function_exists('')

is it possible to use that with next_posts_link() and previous_posts_link().

The reason I'm asking that is that I have something like

<div class="navigation">
    <div class="next-posts"><?php next_posts_link('&laquo; older') ?></div>
    <div class="prev-posts"><?php previous_posts_link('newer &raquo;') ?></div>
</div>

In my case div.navigation has a colored background and a fixed height. So even there is no next or perv post this div.navigation appears. I wonder if I can only display this if there exists a next or prev post?

Any idea how to do that?

share|improve this question
add comment

3 Answers

<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<div class="navigation">
    <div class="next-posts"><?php next_posts_link('&laquo; older') ?></div>
    <div class="prev-posts"><?php previous_posts_link('newer &raquo;') ?></div>
</div>
<?php endif; ?>
share|improve this answer
add comment

Take a look at my (educational) "Easy Pagination Deamon" plugin. I reworked it for readability and it shows you all possibilities you got with pagination.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.