I am trying to solve this problem:
I created new custom post types. When I create a post and assign a category (lets say category-1) to it, and when I try to visit the category-1 url, it appears “There has been an error.”
I tried solving the issue based on the Michal Mau post (How to display regular posts & custom post types that fall under a category using just the generic category template?).
My edited code after adding Michal Mau suggestion looks like this:
<?php if (have_posts()) :
global $wp_query;
$args = array_merge( $wp_query->query, array( 'post_type' => 'any' ) );
query_posts( $args );
while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('post-holder'); ?>>
<?php if(has_post_thumbnail()) {
echo '<figure class="featured-thumbnail"><span class="img-wrap"><a href="'; the_permalink(); echo '">';
echo the_post_thumbnail();
echo '</a></span></figure>';
}
?>
The problem wasn’t solved. I don’t know if there is a mistake pasting the code or any other mistake.
The query_posts solution is not reccomended (see you don’t know query). You should use pre_get_posts hook instead. See:
PS: this should go into your functions.php if (custom post type is set from there) or, preferably, from site specific plugin.