• ronlee426

    (@ronlee426)


    I have a multiple category setup and when I read each post, there are two links at the bottom of the page: Previous Article and Next Article.

    But seems it will goes arcoss categories, not just within the same category.

    Can I modify the setting to make the Previous Article and Next Article links go within the same category only?

    Thank you very much.

    • This topic was modified 5 years ago by ronlee426.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    There is no shortcut for doing this. However, if you can code it on your own, you can achieve this via the child theme.

    Thanks.

    Thread Starter ronlee426

    (@ronlee426)

    Thanks for your information.

    Would you please guide me or give me some hints where and which files I can modify this?

    Hi,
    Please copy single.php file from Cenote and paste into child theme’s main folder and replace

    $args = array(
    					'prev_text' => '<span class="nav-links__label">' . esc_html__( 'Previous Article', 'cenote' ) . '</span> %title',
    					'next_text' => '<span class="nav-links__label">' . esc_html__( 'Next Article', 'cenote' ) . '</span> %title',
    				);
    
    the_post_navigation( $args );

    with the following code:

    $args = array(
    					'prev_text'    => '<span class="nav-links__label">' . esc_html__( 'Previous Article', 'cenote' ) . '</span> %title',
    					'next_text'    => '<span class="nav-links__label">' . esc_html__( 'Next Article', 'cenote' ) . '</span> %title',
    					'in_same_term' => true,
    				);
    
    the_post_navigation( $args );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Previous and Next Article post link only within the same category’ is closed to new replies.