I have the below issue. When I click to the previous/next button of the same category unfortunately i receive the previous/next post hronologically instead of the previous/next post of the same category.
Here is the code:
< div id="previous_post">
< ?php previous_post_link( '%link', __( '<span class="prev"><< Preivous Post</span>', 'esquire' ) ); ? >
< /div>
< div id="next_post"> < ?php next_post_link( '%link', __( '<span class="next">Next Post >></span>', 'esquire' ) ); ? >
< /div>
I've tried to fix my problem with this article http://codex.wordpress.org/Function_Reference/next_post_link but something i am doing wrong.
Any advice please?
Here is the final/correct syntax
Thank you!
for example
I don't want to specify every time each category. I want this to be done automatically. For example, when it shows the posts from category machine and you open to read the first post, when you click to next post, then you must see next post of the same category not the next post in general. If the category is food, then the next post of the same category.
I was clear or I confused you more?
Copy the single.php page from your Parent theme and Paste it to your Child-theme's directory. Open the single.php from child-theme directory and add the following code at the end of file [before get_footer(); ]
After adding this code, paste the following code into your child-theme's Style.css to style the links:
To see these links in actions, visit my website: www.techtutsonline.com
Let me know the results :)