Wednesday, June 9, 2010

Conditional Wordpress Navigation

Hey guys,

This is the way to do it. I figured it out by looking in /wp-includes/link-template.php.

<?php if ($prevPostsLink = get_next_posts_link("Previous")):?>
<li class='active'><?php echo $prevPostsLink;?></li>
<?php else:?>
<li class=''><a href="#" onclick="return false;" class="prev">Previous</a></li>
<?php endif?>
<?php if ($nextPostsLink = get_previous_posts_link("Next")): ?>
<li class='active'><?php echo $nextPostsLink;?></li>
<?php else:?>
<li class=''><a href="#" onclick="return false;" class="next">Next</a></li>
<?php endif?>


None of the following worked for me:


No comments:

Post a Comment