apply different formatting to the first post's page
-
Hello –
I am attempting to do something that seems as though it would be quite simple. I have found questions elsewhere that are similar but are not exactly what I wish to do.
Essentially, on my single.php page I have implemented a Next / Previous bar bellow each post that takes the viewer to the previous post published or to the next post published.
I’ve run into trouble pertaining to the latest published post, where the “Next” button still partially loads. Here is my code:
<div class="pagination clearfix cew_buttonbox"> <table class="cew_prevnextbox3"> <tr> <td style="float:left"><div class="cew_button"><?php previous_post_link('%link', '< Older Post') ?></div></td> <td style="float:right"><div class="cew_button"><?php next_post_link('%link', 'Newer Post >') ?></div></td> </tr> </table> </div>
The generated link to the “next” post does not generate — as desired and expected — because there isn’t a next post. The “previous” link generates just fine. But my div (class=”cew_button”) still loads exactly as I have it styled in CSS, sans the link.
Is there a way to condition that “next” div to NOT appear on the first post’s page? The problem is similar for my oldest published post, in which the “previous” box appears sans the link.
- The topic ‘apply different formatting to the first post's page’ is closed to new replies.