Advertisement
Guest User

Untitled

a guest
Sep 6th, 2012
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. /** add custom post types to archive pages **/
  2. add_filter('pre_get_posts', 'query_post_type');
  3. function query_post_type($query) {
  4.   if ( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
  5.     $post_type = get_query_var('post_type');
  6.     if($post_type)
  7.         $post_type = $post_type;
  8.     else
  9.         $post_type = array('post','events','testimonails','client','services','backstage'); // replace cpt to your custom post type
  10.     $query->set('post_type',$post_type);
  11.     return $query;
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement