Skip to content

Instantly share code, notes, and snippets.

@whyisjake
Created April 1, 2013 18:00
Show Gist options
  • Save whyisjake/5286538 to your computer and use it in GitHub Desktop.
Save whyisjake/5286538 to your computer and use it in GitHub Desktop.
Bring the content from all post types into tag/author/tax pages.
<?
/**
* Add different content types to the main queries.
* This will bring posts, craft, projects, video into the main query. Allows for better archive pages.
* @return string Main category name.
*/
// TODO: Bring in reviews.
function make_add_custom_types( $query ) {
if ( ! is_admin() && $query->is_main_query() && ( $query->is_tag() || $query->is_author() || $query-> is_tax() ) && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array( 'post', 'craft', 'projects', 'video' ));
return $query;
}
}
add_filter( 'pre_get_posts', 'make_add_custom_types' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment