Fixing post navigation ‘prev’ and ‘next’ links
-
I have a problem with the way my WordPress template generates ‘Prev’ | ‘Next’ post links. If you check https://WebAppropriate.com, you’ll see that I’ve wrapped these links in a ‘postnav’ div, which has some styles to make the links look right. However, if the links aren’t generated, the div still shows and adds a load of empty space!
I can see two potential solutions – the first is to find a different script, i.e. one that dynamically generates the links in a div or a ul (shouldn’t this be done anyway, rather than having two links just floating next to each other)? And the other solution is to take all the styles off the containing div, and to place them on the links. I’ve tried the later, and it doesn’t seem to work well in any of the browsers that I use – the padded out links get cut-off at the bottom, and generally don’t seem to be rendered correctly unless they are sat in a div.
At the moment I’m using this;
‘<div class=”postnav clearfix”>
<?php posts_nav_link(‘ – ‘,’« Prev’,’Next »’) ?>
</div>’Also, wouldn’t it be great to have id’s or classes added to each link, so that we could position the ‘Prev’ link on the left, and the ‘Next’ on the right?
And just one more thing… the posts_nav_link doesn’t seem to generate any links on my ‘single.php’ template. Does anyone know why this might be (I’ve cut out the script for now, so you won’t see it on single blog post, but it definitely doesn’t work!)?
- The topic ‘Fixing post navigation ‘prev’ and ‘next’ links’ is closed to new replies.