Being a newbie I am not able to know how to sort my posts based on categories which I have created in WordPress. I am getting my all posts because of the following code mentioned on image:
<?php $recent = new WP_Query(
"post_type=post&posts_per_page=6&orderby=date&order=DESC");
>
Navigation bar is my categories. So on clicking each category I should get posts relevant to that category only. For example clicking on Recipes, I should get all posts related to recipes only. Please suggest me plugins (jQuery) to give that tab the kind of functionality and how I am gonna implement this sort or filter sort of functionality in WordPress. Please help me with some code. Any help would be appreciated.
For best of my knowledge and if I m guessing you right. make category.php(For wordpress post) or taxonomy.php(for custom post type taxonomy)
How about adding the category as a menu.
try this:
$wpq = array(
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 6,
'post_type' => 'post',
'taxonomy' => 'category',
'term' => 'category-slug'
);
$recent = new WP_Query ($wpq);
NOTE: change 'category-slug' with correct Category slug