Ciao a tutti,
Qual è il modo migliore per sostituire the_content() nel loop di alcuni Custom Post type?
Ho scritto questo codice
add_filter('the_content','the_content_filter');
function the_content_filter($content) {
global $post;
if ( $post->post_type == 'my_custom_post' and is_single ( ) ) {
$content = get_template_part('ri_template/ri-single');
} elseif ( $post->post_type == 'my_custom_post' and in_the_loop() ) {
$content = get_template_part('ri_template/ri-loop');
} else {
return $content;
}
}
Qual è il miglior modo per sostituire the_content()?
Grazie in anticipo!`