Support » Plugin: Smarter Navigation » [Plugin: Smarter Navigation] Conditional for showing next/previous links when there's only one

  • Plugin’s great, but..

    I style the background of the next/previous link navigation area with css. The styling shows up even when there are no next/previous posts, which looks silly.
    It used to be like that with pre WP 3 versions of WP, but they finally fixed it and it doesn’t happen anymore.
    However, now that I’ve installed the “Smarter Navigation” plugin, I’m experiencing this problem again.
    I’d love a fix for this if possible.
    If I haven’t been clear, I can post some screen-shots – my site is not live yet.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author scribu


    Please paste the code you are using to display the navigation links.


    Thanks for answering.

    This is the code for navigation links:

    <div id=”nav-below” class=”navigation”>
    <div class=”nav-previous”>
    <?php previous_post_smart( ‘%link’, ‘<span class=”meta-nav”>’ . _x( ‘←’, ‘Previous post link’, ‘twentyten’ ) . ‘</span> %title’ ); ?>
    <div class=”nav-next”>
    <?php next_post_smart( ‘%link’, ‘%title <span class=”meta-nav”>’ . _x( ‘→’, ‘Next post link’, ‘twentyten’ ) . ‘</span>’ ); ?>

    Here’s the CSS for class “navigation” – the problem is that the CSS shows up even when there are NO links:

    background: yellow url(/images/overlay.png);
    border: 1px solid black;

    Plugin Author scribu


    Ok, and you say that if you use the regular previous_post_link() and next_post_link() the problem goes away?


    Thanks, again for responding.

    I was going to say yes to your question above, but decided to check again. I Disabled the plugin ad lo and behold, the styling was still showing up.

    WordPress does a good job hiding navigation for post pages, but a lousy job for hiding it on the single post view.

    Seems that you can set background color to “navigation” and it won’t show if there are no previous/next posts (which made me believe no css would show), but if you set any margins, padding, width or border, the styling shows up and this has NOTHING to do with plugin.

    That said, I now wonder even more if there’s something you could add to the plugin so as to eliminate the display of the “navigation” element altogether when there is only ONE post.


    I’ve published my site, so here are some examples for what I’m talking about:

    Here’s an example when there are previous/next links and how the navigation area css styling looks:

    And here’s an example of a post that is the only post in its category. I have been able to style the navigations links as above without using margins, padding or width, but I had to keep the borders, and as you can see, they show up where the link navigation area is.

    I’m hoping that since your plugin manipulates the navigation that it might be feasible for you to do something about this..

    Hi again,

    I’m still trying to solve my problem with hiding the “navigation” div when there is only one post in a specific category.

    I have actually managed to do it, but the ‘fix’ presents a new problem.
    If I go into single post view via archives, author or tags, navigation links disappear when the previous/next post is of a different category than the first post viewed.

    Could you please explain, perhaps with examples too:

    (1) How to use get_referrer_url.
    (2) How to use the $fallback parameter for previous_post_smart() and next_post_smart().

    I am hoping that perhaps one or both of these may help facilitate what I am trying to achieve. More specifically, I’d like to be able to use 2 different single.php templates: 1 for displaying posts by category, and another for displaying posts by any of archives, authors and tags.

    Any help you may be able to offer will be greatly appreciated.. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Smarter Navigation] Conditional for showing next/previous links when there's only one’ is closed to new replies.