Created
November 22, 2011 15:44
-
-
Save luisabarca/a36126c469156e9c182d to your computer and use it in GitHub Desktop.
Show custom post types in a category
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
<?php | |
add_filter('pre_get_posts', 'init_category'); | |
function init_category($wp_query) | |
{ | |
$vars = $wp_query->query_vars; | |
if (is_category() && !array_key_exists('portfolio', $vars)) { | |
$vars = array_merge( $vars, array('post_type' => 'any') ); | |
$wp_query->query_vars = $vars; | |
} // endif | |
return $request; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment