I've built a simple sales page theme and would like to enhance it a bit by allowing the input of default content (including headers, bullet points, testimonial blockquotes and the ubiquitous "add to cart" button).

What are the options for adding html snippets to content pages and/or posts?

Ideally, when I click "Add New" from the Post or Page menu, the content would already be pre-populated with the sales page default content.

Or perhaps even better, I could add a menu below the "Add New" link like "Add New Salespage" and by clicking that, it would default the sales page content.

I'd like to have a page in my theme folder called salespage.html (or salespage.txt, or salespage.php, whichever is easier to work with) and this would be the content that is used to prepopulate the editor.

Any help much appreciated.

UPDATE: Thanks to Chris_O's answer below, I was able to find the solution. I've augmented Chris suggested solution to load the content from an external file....

if (get_option("cb2_theme") == "salespage")
//added to support salespage creation
add_filter( 'default_content', 'my_editor_content' );

function my_editor_content( $content ) {

    if(file_exists(ABSPATH.'wp-content/themes/clickbump_wp3/styles/salespage/default-content.html')){$content = file_get_contents(ABSPATH.'wp-content/themes/mytheme/styles/salespage/default-content.html');}else{$content = "Enter your salespage content here. h1-h3 tags, blockquotes etc";}

    //$content = "This is some custom content I'm adding to the post editor because I hate re-typing it.";

    return $content;
  • @Scott B: @Chris_O has a good answer but I'm curious so would like to explore: do you envision as salespage.html because that's what you need to that was what occurred to you? Would having a page in the admin where you could actually edit and save the default sales page be preferable? Also, do you only need one or do you maybe need many? BTW, these questions would actually augment @Chris_O's answer, not be an alternate too. Sep 7, 2010 at 1:13
  • @Mike, not sure I understand the first part of your question, could you take a look at it? I don't see a need for too many, each person will have their own unique content, so I'm just trying to give them the basics (headings, intro, bullet points, closing, guarantee, cart button, disclaimer, etc)
    – Scott B
    Sep 7, 2010 at 11:52
  • @Scott B I mean why did you support a file on disk rather than an place in the admin? For multiple, have you considering created a "Sales Letter" custom post type? Sep 7, 2010 at 23:53
  • I had not thought of that, but I thinks its an excellent suggestion so I created another question with that in mind.
    – Scott B
    Sep 8, 2010 at 19:51

1 Answer 1


@Scott B, I just read a post on Justin Tadlocks Blog regarding this same issue.

The Solution

Use the default_content filter hook and it to the themes function.php file.



add_filter( 'default_content', 'my_editor_content' );

function my_editor_content( $content ) {

    $content = "This is some custom content I'm adding to the post editor because I hate re-typing it.";

    return $content;


You could add XHTML or anything you wanted to the $content string

When you click "Add New Post" you get: alt text

  • Thanks, that will work fine. I'll wrap the bits in functions.php so that it only inserts content when the salespage template is active (my theme has multiple templates, only 1 would be appropriate for default content).
    – Scott B
    Sep 7, 2010 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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