Don’t change the main query. You can simply achieve what you want by using pre_get_posts
.Fall back to the default loop in category-5.php and add the following to your functions.php
function include_category_cpt( $query ) {
if ( !is_admin() && $query->is_category( '5' ) && $query->is_main_query() ) {
$query->set( 'post_type', 'eveniment' );
$query->set( 'post_status', 'publish' );
$query->set( 'posts_per_page', '-1' );
$query->set( 'ignore_sticky_posts', '1' );
}
}
add_action( 'pre_get_posts', 'include_category_cpt' );
Also, please note, caller_get_posts
has long time been depreciated and as replaced with posts_per_page
References