Hello,
I used this code and made a plugin specifying a specific post type and it worked perfect. So then I created another plugin and used the same code but designated a different post type and for some reason only one plugin will work at a time... each plugin works independently of the other one but I cannot activate both at the same time or only one of them will work...
Here is the general code for each...
Post Type A
function preset_content_post_type_a() {
global $post;
if ( $post->post_content == '' and $post->post_type == 'post-type-a' ) {
$default_content_post_type_a = 'my preset content text for post type a';
add_post_meta($post->ID, 'my custom field', 'my value', true);
} else
{$default_content_a = $post->post_content;}
return $default_content_a;
}
add_filter('the_editor_content', 'preset_content_post_type_a');
And now Post Type B
function preset_content_post_type_b() {
global $post;
if ( $post->post_content == '' and $post->post_type == 'post-type-b' ) {
$default_content_post_type_b = 'my preset content text for post type b';
add_post_meta($post->ID, 'my custom field', 'my value', true);
} else
{$default_content_b = $post->post_content;}
return $default_content_b;
}
add_filter('the_editor_content', 'preset_content_post_type_b');
Can anyone help me understand how to get both working at the same time so that when I create a new post with the custom post type these templates will work?
I am running 3.1.1
Thank you very much,
Tmelbs