Skip to content
Advertisement

WordPress loop with new. args for else

I would like to show posts in a custom post type with the category ‘pin-post-to-homepage’, then if that doesn’t exist then display posts from a different post type.

Below are the arguments. Feel like I am very close, as the first query works when a post has the category, though the second loop isn’t working at the moment. Are the args added to the else correctly?

Here is my code:

JavaScript

Advertisement

Answer

Try something like this

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement