• Hello, me using BAM theme for wordpress

    On single post page, on the navigation arrows just below the post, how to set to navigate only through a specific category (category current single post)?

    Can you please tell me in what file is that code, I have trouble to find it. Maybe, theme have filter?

    For example:

    function your_prefix_single_post_navigation_same_category( $args ) {
    	$args[ 'in_same_term' ] = true;
    
    	return $args;
    }
    
    add_filter( 'bam_single_post_navigation', 'your_prefix_single_post_navigation_same_category' );

    Thank you very much.

    P. S. “Display related post” has this settings.

    • This topic was modified 3 years, 11 months ago by harchvertelol.
    • This topic was modified 3 years, 11 months ago by harchvertelol.
    • This topic was modified 3 years, 11 months ago by harchvertelol.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter harchvertelol

    (@harchvertelol)

    Bad solution:

    change code in “single.php” (adding ‘in_same_term’ => true):

    if ( true == get_theme_mod( 'bam_single_show_post_nav', true ) ) {
    					// Previous/next post navigation.
    					the_post_navigation(
    						array(
    							'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next Post', 'bam' ) . '</span> ' .
    								'<span class="screen-reader-text">' . __( 'Next post:', 'bam' ) . '</span> <br/>' .
    								'<span class="post-title">%title</span>',
    							'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous Post', 'bam' ) . '</span> ' .
    								'<span class="screen-reader-text">' . __( 'Previous post:', 'bam' ) . '</span> <br/>' .
    								'<span class="post-title">%title</span>',
    							'in_same_term' => true,
    						)
    					);
    				}

    I want solution without changing theme files.

    P. S. I have my plugin, any php-code me can paste to my plugin.

    • This reply was modified 3 years, 11 months ago by harchvertelol.
    • This reply was modified 3 years, 11 months ago by harchvertelol.
    Thread Starter harchvertelol

    (@harchvertelol)

    What about my question?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to set to navigate only through a specific category’ is closed to new replies.