WP Query Widget Boolean
-
Hi
Does anyone know id there are any Widget Booleans in WP_Query?
I need to exclude some post types from the a recent posts widget but need to include those same post types in the main query for the front page…
I am using the pre_get_posts filter…
function all_archive($query) { if( is_admin() || isset($query->query_vars['post_type']) && 'nav_menu_item' == $query->query_vars['post_type'] ) { return; } elseif( is_archive() || is_tag() || is_category() || is_author() || is_year() || is_month() || is_day() || ( is_home() && is_main_query() ) ) { $post_type = get_query_var('post_type'); if($post_type) { $post_type = $post_type; } else { $post_type = array('post','widget'); } $query->set('post_type',$post_type); return $query; } } add_filter('pre_get_posts', 'all_archive');
Any help would greatly be appreciated ??
Thanks!
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘WP Query Widget Boolean’ is closed to new replies.