Tagged Questions
0
votes
0answers
26 views
Pre Get Posts fails with more than 1 Post Type
Inside Functions.php
function custom_filings_archive( $query )
{
if(is_post_type_archive( 'filings' ))
$query->set('post_type',array('the-reports','press-release'));
return $query;
}
...
0
votes
1answer
39 views
pre_get_posts : 'post__not_in' doesn't work with global variable
I'm trying to set a post__not_in which use a global $popular variable, defined in the index.php.
-index.php-
$popular[] = 1 //post id=1
$popular[] = 2 //post id=2
$popular[] = 3 //post id=3
...
4
votes
1answer
186 views
Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
I've registered custom rewrite rules and query_vars to use for displaying a list of events based on ISO date format. For example when a user requests the URL, http://site.com/by-date/2013-04-04/, my ...
0
votes
1answer
140 views
Custom post types loop on a page template
Hi I'm trying to make a page template that shows a list of a custom post type ordered by a meta key, I easily made it with query_posts but I am trying to do it via pre_get_posts so I made a function ...
0
votes
1answer
45 views
Filter multiple different main queries on custom pages
Ok so I have multiple different page templates with a main query that I want to filter the loop for. In my example I try to use a function to filter the main loop of my site and also the main loop for ...
2
votes
2answers
197 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 ...
1
vote
3answers
1k views
$query->query_var['post_type'] not set for pages
Bulding off of this response from @kaiser about being able to filter by post types on a search page, I wanted to be able to automatically add-in all of the public post types available. So, after some ...
0
votes
1answer
1k views
Can I use $query->set() (in a pre_get_posts() hook) with a custom taxonomy in WP 3?
I can do something like the following with a standard category:
$query->set('category__not_in', $term_id);
But how do I do the same with a custom taxonomy term?
I'm using Wordpress 3.3.1 if it ...