Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unfortunately, unless you set a cookie in category.php there is no built-in method to differentiate if a user viewed the post by way of a category archive. If you want to look at doing that checkout the php function <a href="http://us.php.net/setcookie" rel="nofollow">setcookie()</a>.</p> <p>There is an argument for both <a href="http://codex.wordpress.org/Function_Reference/next_post" rel="nofollow">next_post()</a> and <a href="http://codex.wordpress.org/Function_Reference/previous_post" rel="nofollow">previous_post()</a> called 'in_same_cat', it's the last argument in both functions in your example, which you've set to 'no'. Just set them to 'yes' instead and the link will point to sibling posts within the same category. </p> <p>Note, both of those functions have been deprecated. They have been replaced by <a href="http://codex.wordpress.org/Function_Reference/next_post_link" rel="nofollow">next_post_link()</a> and <a href="http://codex.wordpress.org/Function_Reference/previous_post_link" rel="nofollow">previous_post_link()</a>. The arguments have changed slightly, here's an example: </p> <pre><code>&lt;?php next_post('% &amp;lsaquo;&amp;lsaquo;&amp;lsaquo;', 'Previous', 'no', 'yes'); ?&gt; &lt;?php previous_post('&amp;rsaquo;&amp;rsaquo;&amp;rsaquo; %', 'Next', 'no', 'yes); ?&gt; </code></pre> <p>would become:</p> <pre><code>&lt;?php next_post_link('% &amp;lsaquo;&amp;lsaquo;&amp;lsaquo;', 'Previous', 'yes'); ?&gt; &lt;?php previous_post_link('&amp;rsaquo;&amp;rsaquo;&amp;rsaquo; %', 'Next', 'yes'); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload