Custom Post Type Replace the_content() in loop
-
Hi everyone,
What is the best way for replace the_content() in the loop for certain custom post type?i wrote this code
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; } }
what is the best way for replace the_content()?
Thanks in advance!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom Post Type Replace the_content() in loop’ is closed to new replies.