1

Sorry if the question isn't all clear, but I have been struggling with the keyword for this, probably there's a keyword for it that I don't know of. The Wordpress site I'm developing at this moment is for a scientific project, and the writers are student researchers. Thing is, when they are writing their scientific assessments, it would be really helpful for them to use a certain type of format that comes preloaded with the page or blog type, but since I don't know a keyword for it, I'm struggling a bit to find anything regarding it.

Perhaps a better explanation: I click "Add New Page" or "Add New Post", and when the editor shows up, it has some contents in there already that just need to be extended, instead of having to type all of it again.

How one would go by developing it?

Hopefully my question and explanation is clear enough. Thanks!

  • I'm thinking that probably I could load up a initial table for the page type as if it's some sort of saved post/page, and then output the new saved information to another one would be the way to go about it, but just not sure if this is the best way to do it. – Luke Perez Jun 5 '18 at 21:32
1

You can do this like this: (answering from mobile. Please forgive if the markup is broken)

add_filter( 'default_content', 'preloaded_editor_content', 10, 2 );

function preloaded_editor_content( $content, $post ) {

    switch( $post->post_type ) {
        case 'your_post_type':
            $content = 'your content';
        break;
        default:
            $content = 'your default content';
        break;
    }

    return $content;
}
  • Ah, interesting, by any chance do you know of anything a little more substantial on how to do it? Also, does it have a keyword that I could check on? It's a major struggle researching on how to do something that doesn't have a name. Or if you have any other inputs on how I could go about it, it would be of great help, thanks a bunch! – Luke Perez Jun 5 '18 at 21:41
  • I'm sorry not mention how to implement. All you have to do is to add the code I gave you in your theme's functions.php file. Yes the keyword is " wp default_content" google it you will find more solutions. – Sabbir Hasan Jun 5 '18 at 21:44
  • You can use this plugin too wordpress.org/plugins/my-default-post-content – Sabbir Hasan Jun 5 '18 at 21:50
  • Interesting, nice! I will excavenge the plugin for code information, I prefer to build the sites with their parts properly added without plugins (think it's better practice). Thanks for all the help, it was extremely helpful. Have a good one! – Luke Perez Jun 5 '18 at 21:56

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.