• Resolved Alain Aubry

    (@caban13)


    Hi
    The addition of “Next/Previous Posts” in single post view was a nice addition.
    Next comes a request:
    What about moving along ‘Categories’? Wouldn’t be nice?
    Thanks
    Alain

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Alain

    Thanks for your message.

    The next/previous navigation in posts and categories has been in Unwind since release.

    Check Settings > Reading, how many posts are your blog page set to show before breaking them into pages? See the setting: Blog pages show at most. Do your categories have more posts than that number?

    Thread Starter Alain Aubry

    (@caban13)

    Hi

    Sorry I did not came here in so much time!

    I guess I need to clarify, I was talking of “Post navigation, Display next and previous post navigation“. Maybe it was always there but disabled by default. At some point this post navigation showed up without doing anything. This is why I thought it was an addition. Never mind!

    About the request: It would be nice to have the Next/Previous Posts buttons moving inside the current Category. Currently they go trough all categories. Maybe with a switch to select behavior.

    Thanks!

    Thanks for your feedback, that makes sense although I’m not sure when that happened. Sorry I don’t have more info.

    The WordPress theme next/previous post navigation is by default a chronological function, it can however be customised to stay within the category. I’ll reply a bit later with a solution.

    Thread Starter Alain Aubry

    (@caban13)

    Thanks!

    Try this. Go to Plugins > Add New, install Code Snippets > Activate. Go to Snippets > Add New, name the snippet any name you’d like, insert in the snippet body:

    if ( ! function_exists( 'siteorigin_unwind_the_post_navigation' ) ) :
    /**
     * Display navigation to next/previous post when applicable.
     */
    function siteorigin_unwind_the_post_navigation() {
    	// Don't print empty markup if there's nowhere to navigate.
    	$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( true, '', true );
    	$next     = get_adjacent_post( true, '', false );
    
    	if ( ! $next && ! $previous ) {
    		return;
    	}
    	?>
    	<nav class="navigation post-navigation" role="navigation">
    		<h2 class="screen-reader-text"><?php esc_html_e( 'Post navigation', 'siteorigin-unwind' ); ?></h2>
    		<div class="nav-links">
    			<div class="nav-previous">
    				<?php previous_post_link ( '%link', '<span class="sub-title"><span>&larr;</span> ' . __( 'Previous Post', 'siteorigin-unwind' ) . '</span> <div>%title</div>' ); ?>
    			</div>
    			<div class="nav-next">
    				<?php next_post_link( '%link', '<span class="sub-title">' . __( 'Next Post', 'siteorigin-unwind' ) . ' <span>&rarr;</span></span> <div>%title</div>' ); ?>
    			</div>
    		</div><!-- .nav-links -->
    	</nav><!-- .navigation -->
    	<?php
    }
    endif;

    Opt to run the snippet on the site front end.
    Click Save Changes and Activate, not just Save Changes.

    Does that help? Be sure to save and activate.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Next/Previous Post’ is closed to new replies.