Hide the last Previous Posts Link

Community Forums Forums Design Tips and Tricks Hide the last Previous Posts Link

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  DavidF 2 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #39265


    My blog is hands on : as we grow.

    I’ve noticed that the “Older Posts” button (previous_posts_link) shows still at the end and goes to a 404 page when there’s no more. It also shows on WP pages.

    How can I hide the previous_posts_link on the last page? As well as on pages?

    Currently, I’m using code in the Simple Hooks plugin to make it an image (instead of using the standard text) as well as skipping over one category (306).

    <div class="prev_next">
     <div class="nav_right">
     <span class="prev"><?php
    previous_posts_link(&#8216;&lt;img src=&quot;<a href="http://handsonaswegrow.com/wp-content/uploads/newer-posts.png&quot;&#038;gt" rel="nofollow">http://handsonaswegrow.com/wp-content/uploads/newer-posts.png&quot;&#038;gt</a>;&#8217;, $excluded_categories = &#8216;306&#8217;); ?&gt;&lt;/span&gt;&lt;/div&gt;
     &lt;div class=&quot;nav_left&quot;&gt;
     &lt;span class=&quot;next&quot;&gt;&lt;?php next_posts_link
    (&#8216;&lt;img src=&quot;<a href="http://handsonaswegrow.com/wp-content/uploads/older-posts.png&quot;&#038;gt" rel="nofollow">http://handsonaswegrow.com/wp-content/uploads/older-posts.png&quot;&#038;gt</a>;&#8217;, $excluded_categories = &#8216;306&#8217;); ?&gt;&lt;/span&gt;&lt;/div&gt;

    How can I add conditional code to not show on pages?

    How can I not show the “Older Posts” link when its the last page in pagination?



    To turn off the link on ‘all’ posts you can simply use


    If you only want it off on certain post you can use the same code above but also give the post a body style class in the post CSS settings.

    Love you blog!


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.