Created
April 1, 2013 18:00
-
-
Save whyisjake/5286538 to your computer and use it in GitHub Desktop.
Bring the content from all post types into tag/author/tax pages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/** | |
* 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