Okay
  Public Ticket #1686417
Posts Navigation
Closed

Comments

  •  2
    Alex started the conversation

    Howdy mega-creatives!

    A query about the navigation system at the base of the posts and whether there is any way to make that only show the posts under categories only?

    In the post I have linked to above, the navigation goes on into the next category from Publications into Exhibitions.

    Is there any way to make that just show the posts within its own category only?

    Or will I need to manually try and recreate that as closely as I can at the bottom of each post?

    Thanks for any assistance you can offer.

  •  296
    Paul replied

    Hi Alex!

    The option for linking posts of the same categories is only available for portfolio items (Customizer > Portfolio Options > Make Post Navigation Link All Categories). But for normal blog posts, I am afraid there is no option for that.

    Anyway, you can easily customize the theme to add such feature. Please do:

    1. Create a new child theme. You can find the how-to steps here: https://uxbarn.ticksy.com/article/8649/

    2. In the "functions.php" file of the created child theme, add the following code:

    function aina_print_post_navigation() {
            
            echo '<div class="next-prev-post-navigation content-width hover-style">';
                
                the_post_navigation( array(
                    
                    'prev_text' => '<span class="screen-reader-text">' . esc_html__( 'Previous Post', 'aina' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . esc_html__( 'Previous', 'aina' ) . '</span> <span class="nav-title"><span class="nav-title-icon-wrapper"><i class="ion-ios-arrow-thin-left"></i></span>%title</span>',
                            
                    'next_text' => '<span class="screen-reader-text">' . esc_html__( 'Next Post', 'aina' ) . '</span><span aria-hidden="true" class="nav-subtitle">' . esc_html__( 'Next', 'aina' ) . '</span><span class="nav-title">%title<span class="nav-title-icon-wrapper"><i class="ion-ios-arrow-thin-right"></i></span></span>',
                    
                    'in_same_term' => true,
                ) );
                
            echo '</div>';
                
        }
    

    That's it. Now the blog post navigation should show only the posts that have the same categories.

    I hope it helps.

    Cheers,
    Paul

  •  2
    Alex replied

    Paul you are a gem!

    Thank you so much for your assistance with this, I'll give it a go in the morning, it's bedtime DownUnder!

    Thanks too for not making me seem like an idiot for not knowing how to do this already! I had some atrociously condescending responses from another design team in the past. You folks rock!

  •  2
    Alex replied

    Paul, thanks heaps! It works! Perfectly! In the various categories of Posts and from within the various categories of the Portfolio also!

    Very cool.

    Now to sort out getting the Publications and Exhibitions to appear so the most current are first instead of last...