Created
January 24, 2014 08:18
-
-
Save jwebcat/8593828 to your computer and use it in GitHub Desktop.
Add custom post types to pre_get_posts for main loop WP
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_filter( 'pre_get_posts', 'my_get_posts' ); | |
function my_get_posts( $query ) { | |
if ( is_category() && $query->is_main_query() ) | |
$query->set( 'post_type', array( 'post', 'page', 'fonts' ) ); | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment