The 'Blog' and 'Recipes' sections on the homepage both utilize the very versatile 'Display Posts Shortcode' plugin.


There are lots of parameters you can use with it which is covered in the plugin's documentation.




Excluding a Category


On the homepage, we might want to display all blogs posts except for the Recipes category. To do this, we use the cat_not_in value.


So by default it looks like this:


[display-posts posts_per_page="4" image_size="large" include_date="true" date_format="F j, Y" ignore_sticky_posts="true" cat_not_in="27"]


You see the 27? That excludes the category id 27. Now, the category you want to exclude may not be 27 - to find it - go to Posts > Categories and hover over it.


You'll see at the bottom something like this. The tag_ID=27 is the category number. So replace the cat_not_in value with whatever you see.






Including only a particular Category


We might want to then show only blog posts belonging to a certain category. This one is pretty easy. The category="Recipes" will pull it only blog posts assigned to that category.


Of course, if you name it differently to say 'Food' you'll need to change this to category="Food"


[display-posts posts_per_page="3" image_size="large" ignore_sticky_posts="true" category="Recipes"]