I'm working with Custom Query in WordPress, Basically, I'm showing 4 most recent posts of a category having ID 4 and my query is as follows:-
$args = array( 'post_type' => 'post' , 'orderby' => 'date' , 'order' => 'DESC' , 'posts_per_page' => 4, 'cat' => '3', 'paged' => get_query_var('paged'), ); $q = new WP_Query($args);
This is working fine, but here I have an additional requirement. I want to add sticky posts as well i.e Posts will be stick to the top no matters these posts are recent or old, and total posts_per_page should be always 4 including sticky and recent posts.
e.g If there is no sticky post then I'll show 4 most recent posts and no sticky post. But if there is 1 sticky post then there will be 1 sticky post and 3 most recent posts, a total of 4 posts.
What modification should I made in my Query? Thank you.