0
votes
1answer
37 views

Can I set my WP_Query to be a Main Query?

When I create a WP_Query it's automatically considered a "secondary query", but what if I replace my main query with a WP_Query? Can I set my WP_Query to be considered a "Main Query"? The reason I ...
0
votes
2answers
99 views

Change post order by meta key, per post basis

I have a loop definition like this in functions.php: function artist_list($query) { if ( is_admin() || ! $query->is_main_query() ) { return; } // Target the artists page if ...
0
votes
0answers
24 views

Load Index on “Earlier” Post, Prev and Next Links

how would i load the index of my blog at a later point in the reverse chronological feed while maintaining the chronology of the feed overall? i found this explanation of how to load the feed at a ...
1
vote
1answer
166 views

Modify the main loop to display current month / year

So pre_get_posts seems to be the way to do this now - a lot of the background is nicely explained here: When to use WP_query(), query_posts() and pre_get_posts I can happily modify the main loop to ...
0
votes
1answer
171 views

pre_get_posts works in post type archive but not in single post

I have a custom post type "Scholars" that has an archive. I want to sort by a custom meta field called "year", I'm doing this with pre_get_posts: add_action('pre_get_posts', 'my_queries'); function ...
0
votes
1answer
36 views

Get query result before posts are displayed?

If I want to modify the query, I can use pre_get_posts filter. But what if I want to loop through the queried posts before they are ran through the The Loop? Is there a filter/action hook for that? I ...
0
votes
2answers
624 views

Using pre_get_posts to filter one loop in a multiloop archive

I have a custom-post-type archive (archive-rg_blog.php) with two loops in it. One of the loops I'd like to filter with the below code. It's just a basic loop for all posts, and I just need to set it ...
0
votes
1answer
212 views

Insert/sticky specific post into Loop at specific location

I'm having a hard time determining the first direction to take with this. I'm trying to write a plugin that allows users to pick a location for a post to be inserted into the homepage. For example a ...
2
votes
2answers
278 views

Splitting the main query in multiple loops with query_posts and/or pre_get_posts?

I have a custom post type 'events', to which I have associated a custom taxonomy 'calendar'. The calendar has 12 fixed terms, for each month of the year ( 'august', 'october', 'november, etc.). I'm ...
4
votes
1answer
479 views

How-to exclude terms from the main query the most performant way?

This Q is a follow up to this answer on the Q: "How to exclude a specific term for the search?". 4 ways to filter out posts that have a specific term Type | Pro | ...
2
votes
2answers
1k views

“pre_get_posts” firing on every query

How can I change arguments for the main query only, and not affect other queries? add_filter('pre_get_posts', 'custom_post_count'); function custom_post_count($query){ ...