{"id":5272327,"date":"2014-09-09T05:53:22","date_gmt":"2014-09-09T05:53:22","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/previousnext-post-in-same-category\/"},"modified":"2016-08-22T01:17:58","modified_gmt":"2016-08-22T01:17:58","slug":"previousnext-post-in-same-category","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/previousnext-post-in-same-category\/","title":{"rendered":"Previous\/Next post in same category"},"content":{"rendered":"<p>I&#8217;ve amended template-tags.php in the inc folder to read:<\/p>\n<pre><code>if ( ! function_exists( &#039;isola_paging_nav&#039; ) ) :\n\/**\n * Display navigation to next\/previous set of posts when applicable.\n *\/\nfunction isola_paging_nav() {\n\t\/\/ Don&#039;t print empty markup if there&#039;s only one page.\n\tif ( $GLOBALS[&#039;wp_query&#039;]-&gt;max_num_pages &lt; 2 ) {\n\t\treturn;\n\t}\n\t?&gt;\n\t&lt;nav class=&quot;navigation paging-navigation&quot; role=&quot;navigation&quot;&gt;\n\t\t&lt;h1 class=&quot;screen-reader-text&quot;&gt;&lt;?php _e( &#039;Posts navigation&#039;, &#039;isola&#039; ); ?&gt;&lt;\/h1&gt;\n\t\t&lt;div class=&quot;nav-links&quot;&gt;\n\n\t\t\t&lt;?php if ( get_next_posts_link() ) : ?&gt;\n\t\t\t&lt;div class=&quot;nav-previous&quot;&gt;&lt;?php next_posts_link( __( &#039;&lt;span class=&quot;meta-nav&quot;&gt;&amp;larr;&lt;\/span&gt; Older posts&#039;, &#039;isola&#039;, TRUE ) ); ?&gt;&lt;\/div&gt;\n\t\t\t&lt;?php endif; ?&gt;\n\n\t\t\t&lt;?php if ( get_previous_posts_link() ) : ?&gt;\n\t\t\t&lt;div class=&quot;nav-next&quot;&gt;&lt;?php previous_posts_link( __( &#039;Newer posts &lt;span class=&quot;meta-nav&quot;&gt;&amp;rarr;&lt;\/span&gt;&#039;, &#039;isola&#039;, TRUE ) ); ?&gt;&lt;\/div&gt;\n\t\t\t&lt;?php endif; ?&gt;\n\n\t\t&lt;\/div&gt;&lt;!-- .nav-links --&gt;\n\t&lt;\/nav&gt;&lt;!-- .navigation --&gt;\n\t&lt;?php\n}\nendif;\n\nif ( ! function_exists( &#039;isola_post_nav&#039; ) ) :\n\/**\n * Display navigation to next\/previous post when applicable.\n *\/\nfunction isola_post_nav() {\n\t\/\/ Don&#039;t print empty markup if there&#039;s nowhere to navigate.\n\t$previous = ( is_attachment() ) ? get_post( get_post()-&gt;post_parent ) : get_adjacent_post( false, &#039;&#039;, true );\n\t$next     = get_adjacent_post( false, &#039;&#039;, false );\n\n\tif ( ! $next &amp;&amp; ! $previous ) {\n\t\treturn;\n\t}\n\t?&gt;\n\t&lt;nav class=&quot;navigation post-navigation&quot; role=&quot;navigation&quot;&gt;\n\t\t&lt;h1 class=&quot;screen-reader-text&quot;&gt;&lt;?php _e( &#039;Post navigation&#039;, &#039;isola&#039;, TRUE ); ?&gt;&lt;\/h1&gt;\n\t\t&lt;div class=&quot;nav-links&quot;&gt;\n\t\t\t&lt;?php\n\t\t\t\tprevious_post_link( &#039;&lt;div class=&quot;nav-previous&quot;&gt;%link&lt;\/div&gt;&#039;, _x( &#039;&lt;span class=&quot;meta-nav&quot;&gt;&amp;larr;&lt;\/span&gt; %title&#039;, &#039;Previous post link&#039;, &#039;isola&#039;, TRUE ) );\n\t\t\t\tnext_post_link(     &#039;&lt;div class=&quot;nav-next&quot;&gt;%link&lt;\/div&gt;&#039;,     _x( &#039;%title &lt;span class=&quot;meta-nav&quot;&gt;&amp;rarr;&lt;\/span&gt;&#039;, &#039;Next post link&#039;,     &#039;isola&#039;, TRUE ) );\n\t\t\t?&gt;\n\t\t&lt;\/div&gt;&lt;!-- .nav-links --&gt;\n\t&lt;\/nav&gt;&lt;!-- .navigation --&gt;\n\t&lt;?php\n}\nendif;<\/code><\/pre>\n<p>The TRUE parameter should only link to the next post in the same category, but it isn&#8217;t, it&#8217;s being ignored.  <\/p>\n<p>Any clues?<\/p>\n","protected":false},"template":"","class_list":["post-5272327","topic","type-topic","status-closed","hentry","topic-tag-category","topic-tag-next","topic-tag-previous"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5272327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5272327\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5272327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}