the_content filter (Template)
-
Hi everybody,
at first i hope i can explain what i mean. English is not my native language.
I have programmed a plugin. Inside this plugin i was including via shortcode a template to my content. This was working fine. But now i have the problem that my content become a custom post type called (wppi). Now i have the problem that the_content is filled with text. But it must be filled with my template (my template gets several custom fields and pictures and shows it in single view).
My actual solution for this problem looks like this:
function wppi_theme_content_filter($content) { $post = $GLOBALS['post']->ID; $ntype = get_post_type($post); //echo $ntype; if ($ntype == 'wppi') { $wppi_description = get_the_content($post); wp_product_includer_template_two_cols_left_2($post, $wppi_description); } else { print_r ($content); } } add_filter( 'the_content', 'wppi_theme_content_filter' );
In this function i add my template to the_content and it works.
The problem in this function is the elseprint_r ($content);
This shows only text (i know it is just print_r). So what can i do that when my post is not CP (wppi) the_content is untouched.
- The topic ‘the_content filter (Template)’ is closed to new replies.