wordpress navigation php

Taha117

New Member
Messages
8
Reaction score
0
Points
0
Hi i would like to use this php code to display next and previous posts in posts in categories, but i dont want it to display anything if there is nothing left in the category, currently this code displays the next post made outside of any category if the current category has no more posts.

according to wordpress codex the parameter for this is in_same_cat
here is the url for the entire wordpress codex page related to my question http://codex.wordpress.org/Template_Tags/previous_post please post the revised code below, your help will be greatly appretiated

heres the code im currently using

<?php
/*
Template Name: Navigation
*/
?>
<?php if (is_single()) { ?>
<div class="navigation">
<div class="floatleft">
<?php previous_post_link ('&laquo; %link') ?>
</div>
<div class="floatright">
<?php next_post_link('%link &raquo;') ?>
</div>
</div>
<?php } else { ?>
<div class="navigation"><?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?>
<div class="floatleft">
<?php next_posts_link('&laquo; '.__('Previous Entries','unnamed').''); ?>
</div>
<div class="floatright">
<?php previous_posts_link(''.__('Next Entries','unnamed').' &raquo;'); ?>
</div>
</div>
<?php } ?>
 
Top