WordPress Snippets at WPcustoms

Include custom post types in your archives

Archives.php template includes custom post types


/**
 * Snippet Name: Include custom post types in your archives
 * Snippet URL: http://www.wpcustoms.net/snippets/include-custom-post-types-archives/
 */
 function wpc_add_custom_types( $query ) {
  if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
    $query->set( 'post_type', array(
     'post', 'YOUR_POST_TYPE'
        ));
      return $query;
    }
}
add_filter( 'pre_get_posts', 'wpc_add_custom_types' );