Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Displaying pagination even when there’s no previous posts

Discussion in 'Misc WordPress Requests' started by Howdy_McGee, Nov 1, 2017.

  1. Howdy_McGee

    Guest

    Reply To: Displaying pagination even when there’s no previous posts, by Howdy_McGee

    This is from a devs perspective, I’m not sure if there’s a plugin out there that will do this but it seems niche.

    1) Copy the HTML of the previous post link either from source or html it yourself, etc.

    2) Get the current page, probably at the top of the page underneath get_header() or whatnot for organization.

    3) Conditionally show said HTML based on the paged variable:

    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;

    if( $paged > 1 ) {
    previous_posts_link( 'Previous' );
    } else {
    echo '<a href="javascript:void(0);" style="pointer-events:none;">Previous</a>';
    }

    Reply To: Displaying pagination even when there’s no previous posts
     
    #1

Share This Page

Web Hosting