WordPress.org

Support

Support » How-To and Troubleshooting » Advanced Layout Templates In WordPress’ Content Editor

Advanced Layout Templates In WordPress’ Content Editor

  • I have follow this tutorial:
    see here…

    well, it’s wonderfull tips…but i have a question.
    i want style editor only for a specific page, i have try with more and more code (query page etc..) but nothing..someone can illuminate me 🙂
    thanks all.

    this is the code:

    <?php
       add_filter( 'default_content', 'custom_editor_content' );
       function custom_editor_content( $content ) {
       $content = '
          <div class="content-col-main">
          This is your main page content
          </div>
          <div class="content-col-side">
          This is your sidebar content
           </div>
       ';
       return $content;
       }
    ?>

Viewing 10 replies - 1 through 10 (of 10 total)
  • Give me a few minutes and I will test this to make sure it will work for you. You only want it for a specific page correct?

    Wow… You Are great..
    Yes i want only for a specific page.

    Ok So I am working on it right now and I am learning that the default_content filter is only fired upon creating a new post or page, Meaning we cant trigger this by a specific page after it has been created.

    Sooooo what I am thinking of how we can trigger this upon creating the page. We need to tell the filter whether or not to fire based on some type of condition. Give me a little more time

    Ok I figured it out. Give me a few minutes and I will post the final code.

    I take that back found a bug in my script. It works but it will overide whatever you create once you save it. I am still working on it

    Ok I am at a bit of a stand still with this issue and the more I think about it why wouldnt you just create this on your own? If its only one page then why not just add this by hand and call it a day? Its only really needed to save time from creating this on every page. Its really cool but I am not seeing the need.

    It would be useful for formatting for the customer.
    Do you have other methods to allow this?

    esmi
    Forum Moderator

    @esmi

    My page is a custom page template, but wath is the best way for a client?

    You can style the page for them. Just create the page and lay in the template you wanted to add. Then save it and allow them to change the content.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Advanced Layout Templates In WordPress’ Content Editor’ is closed to new replies.