WordPress.org

Forums

Advanced Layout Templates In WordPress’ Content Editor (11 posts)

  1. gioska
    Member
    Posted 3 years ago #

    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;
       }
    ?>
  2. Jeff Clark
    Member
    Posted 3 years ago #

    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?

  3. gioska
    Member
    Posted 3 years ago #

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

  4. Jeff Clark
    Member
    Posted 3 years ago #

    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

  5. Jeff Clark
    Member
    Posted 3 years ago #

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

  6. Jeff Clark
    Member
    Posted 3 years ago #

    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

  7. Jeff Clark
    Member
    Posted 3 years ago #

    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.

  8. gioska
    Member
    Posted 3 years ago #

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

  9. esmi
    Forum Moderator
    Posted 3 years ago #

  10. gioska
    Member
    Posted 3 years ago #

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

  11. Jeff Clark
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.