0

Is there any possiblity to add in a body template to the default wordpress posts? so whenever I create a post it should appear as a template inside of the body text field

0

Simply add following code to your theme functions.php

function better_default_post_content( $content ){
    if( empty( $content ) )
        $content = "Default Template is here!";
    return $content;
}
add_filter( 'the_editor_content', 'better_default_post_content' );

With "the_editor_content" filter you can filter WordPress TinyCME editor value for changing values. In this code i added a filter for that.

It's so simple if you know WordPress action filters. you can read this for action filters: http://wpcandy.com/teaches/how-to-use-wordpress-hooks/

| improve this answer | |
  • Please edit and add some details how your code is working and how it's providing the solution. :) – Mayeenul Islam Dec 5 '14 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.