Home Forums Pro Themes Magpaper Pro Restrict Next and Previous post links to current category

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #190973
    agregatwebmaster
    Participant

    Hi, I would like to list posts from a specific category; and I would like to configure the individual posts so that the next/previous post links are restricted to the current category.

    Is there a way to achieve this?

    Thanks

    #191012
    Psink
    Keymaster

    First, you need to add WPCode plugin to added the PHP snippet.

    And here is the code

    remove_action( ‘magpaper_pro_action_post_pagination’, ‘magpaper_pro_post_pagination’, 10 );
    add_action( ‘magpaper_pro_action_post_pagination’, ‘magpaper_pro_new_post_pagination’, 10 );
    function magpaper_pro_new_post_pagination() {
    the_post_navigation( array(
    ‘prev_text’ => magpaper_pro_get_svg( array( ‘icon’ => ‘up’ ) ) . ‘%title‘,
    ‘next_text’ => ‘%title‘ . magpaper_pro_get_svg( array( ‘icon’ => ‘up’ ) ),
    ‘in_same_term’ => true,
    ) );
    }

    Please follow the screen record and add this code on your site
    https://www.awesomescreenshot.com/video/21420290?key=fd90b6e39aaf0a2a72aa57c24060f507

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.