Hi, the add_filter (‘content’, …) approach will not work properly.
You might want to start by using the WordPress template hierarchy (with a copy of index.php file) or with these snippets for a more advanced developer approach : change the WordPress query.
Hope this helps and enjoy the theme
@ chicchera
I’ve just spent the last 3 days banging my head against the keyboard.
Assuming you have a child theme and you registered properly the CPT and you see them in the dashboard, I did some renaming here and there to be able to see and use theme front-end. here is the list:
1) make a copy index.php and rename it into single-yourCPTname.php
2) make a copy index.php and rename it into archive-yourCPTname.php
1 makes your single CPT visible
2 makes your CPTs in a list
Depending on how you created your CPT (with custom taxonomy or standard, etc) this “old” snippet below helps to integrate your CPT with all the other WP elements;
paste this into your functions.php
//Add Custom Post Types to Tags and Categories in WordPress
function add_custom_types_to_tax( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
// Get all your post types
$post_types = get_post_types();
$query->set( 'post_type', $post_types );
return $query;
}
}
add_filter( 'pre_get_posts', 'add_custom_types_to_tax' );
//http://premium.wpmudev.org/blog/add-custom-post-types-to-tags-and-categories-in-wordpress/