Hi,
I am working with the Connections theme and I would like to write if statements for previous and next posts links in the sidebar.
To keep the style consistent with the theme, I am trying to create a sentence around each link, and I don't want the entire thing to be hyperlinked. But I also don't want any of the one sentence or the other to show up if there is no previous or next post to go with it. I thought an if statement would be the way to go. Unfortunately I still have a very long way to go in understanding php.
Here's what I tried:
<?php if ($previous_post) { ?>
<li>You can go to the <?php previous_post('%', 'Previous Post: ', 'yes'); ?>. </li>
<?php } ?>
<?php if ($next_post) { ?>
<li>You can go to the <?php next_post('%', 'Next Post: ', 'yes'); ?>.</li>
<?php } ?>
Nothing from within that code shows up on the page, whether or not there are previous or next posts available. Can anyone tell me what I need to do to get this to work the way I want? Is there another way to do it?
Thank you! :)
(BTW: The Using Specific Text example code on the Codex page for the "next post" tag does not work as shown.)