• Resolved neilc

    (@neilc)


    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!)?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter neilc

    (@neilc)

    Any ideas on this one?

    Thread Starter neilc

    (@neilc)

    I just fixed this problem by trying some different styles on the chunky, blocky ‘Next’ and ‘Prev’ links. Check the stylesheet for the ‘div.postnav a’ styles.

    It would’ve helped if WordPress would dynamically generate these ‘postnav’ links using a div, ul, or just some way of hooking on to each of the links (or if there is a way to do this, I haven’t found it!).

    The PageNavi plugin is another option – you get a great page navigation system, and you can opt to have it always on, so that users know exactly where they are. I’ve used it on another site, and I’ll probably get round to putting it on WebAppropriate.com too.

    https://lesterchan.net/wordpress/readme/wp-pagenavi.html

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fixing post navigation ‘prev’ and ‘next’ links’ is closed to new replies.