• Resolved sofafrog

    (@sofafrog)


    The code <?php posts_nav_link(); ?> is showing no text at all at the bottom of my most recent posts. If I past it above <?php endwhile; else: ?> it will show and work below each post but if I move it below <?php endwhile; else: ?> so it will only show once at the bottom it won’t show up at all.

    Can someone please give me some advice?

    <div id="wrapper">
    <div id="main">
    
      <div id="content">
    
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <p id="posthead"><a href="<?php the_permalink();?>" ><?php the_title(); ?></a>
       </p>
        <p id="postdate">Posted on <?php the_time('F jS, Y') ?></p>
        <p><?php the_content(__('(more...)')); ?></p>
        <p id="categories"><strong>Categories:</strong>?<?php the_category(','); ?> </p>
    
        <p id="commentlink"><a href="<?php the_permalink();?>" ><?php comments_number(); ?></a>
    
        </p><p>?</p>
    
            <hr><p>?</p>
            <?php endwhile; else: ?>
      <?php posts_nav_link(); ?>
    
             <p><?php _else('Sorry, no posts matched your criteria.'); ?></p>
    <p>?</p>
    
        <?php endif; ?>
        <script type="text/javascript">stLight.options({publisher: "352b69ee-ce5f-4135-a517-2cfe778dc258", doNotHash: false, doNotCopy: false, hashAddressBar: true});</script>
    <script>
    var options={ "publisher": "352b69ee-ce5f-4135-a517-2cfe778dc258", "position": "left", "ad": { "visible": false, "openDelay": 5, "closeDelay": 0}, "chicklets": { "items": ["facebook", "twitter", "linkedin", "stumbleupon", "pinterest", "email", "sharethis"]}};
    var st_hover_widget = new sharethis.widgets.hoverbuttons(options);
    </script>
      </div>
    
      <?php get_sidebar(); ?>
    
    </div>

    Link to me site: https://sofafrog.com/

Viewing 1 replies (of 1 total)
  • Because you have it inside the ELSE of the IF statement:

    Following the current logic:

    IF THERE ARE POSTS
    ... WHILE THERE ARE POSTS SHOW POST
    IF THERE ARE NO POSTS
    ... SHOW POSTS_NAV_LINK AND WRITE "Sorry, no posts matched your criteria."

    As you can see, currently that code would only show the posts_nav_link if there were no posts.

    You need to at it between the endwhile; and the else:

    <?php
    endwhile; posts_nav_link(); else:
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘nav_link not showing at all’ is closed to new replies.