I’ve search high and low but have been unable to find a solution to my problem. Hopefully this isn’t a duplicate question that I was unable to find through search here and on google.
I’m attempting to have a wp_query return a set number of results (10) that are populated by any posts found in the current pages category. I was able to accomplish this with…
$postCategories = get_the_category();
$atts = array (
'posts_per_page' => 10,
'tag' => 'sticky',
'category_name' => $postCategories[0]->slug,
);
But where I’m having trouble is with the tag. I would like any posts that have the tag ‘sticky’ to take priority over any of the posts being brought in by the category match while not adding any more than 10 results still.
Any help or guidance would be much appreciated as i’m kind of a newbie to php. Thanks
I think this could work for you, but it’s hard to know for sure without knowing the specifics of your project.