2019년 10월 18일 금요일

Post-navigation links for the same category in Wordpress (게시글의 이전/다음 링크가 같은 카테고리로만 보이게 하기, 워드프레스)

In single.php, after content code

get_template_part( 'template-parts/post/content', get_post_format() ); //  content code

there is the code for post navigation (means links to move between this and that posts)

the_post_navigation(
  array(
    'prev_text' => '...' . '...',
    'next_text' => '...' . '...',
  )
);

it shows two links for the previous post and next one of the current post at the bottom of the screen,
however, the problem is when you click/tab the links again and gain, you find the links include any posts from all different categories, just in order of their written date and time.

Here is the way to move among only one category, even though you keep clicking/tabbing the prev/next links.

the_post_navigation(
  array(
    'prev_text' => '...' . '...',
    'next_text' => '...' . '...',
    'in_same_term' => true,
    'taxonomy' => 'category',
  )
);

Yup, adding that two lines are all.
Happy wordpressing!

Xubuntu: Installing a Printer (Canon G3060 PIXMA)

$ sudo apt install system-config-printer Download the proper driver for linux from Canon website. Turn on the printer and set up its WiFi. C...