Function to make specific category posts load before (first) others (second)?
-
I want to display posts from a specific category (first) similar to a “feature”, then have the other posts fall behind. Not sure if this is a function that I can add?
Also, I’d like the same thing to occur within search results (if one of the posts shows up in the results). I’d like it to appear before any of the others.
I was going to use the following:
function exclude_category($query) { if ($query->is_home) { $query->set('cat', '-7,-67,-6'); } return $query; } add_filter('pre_get_posts', 'exclude_category');
but that just removes posts from a specific category. Not making them first or second level.
thanks!
- The topic ‘Function to make specific category posts load before (first) others (second)?’ is closed to new replies.