The MU forums have moved to WordPress.org

How do I get TinyMCE WYSIWYG to add <p> tags and <br> tags? (8 posts)

  1. jonperry
    Member
    Posted 14 years ago #

    My site is almost how I want it except for the fact that TinyMCE won't add <p> tags when I hit enter on my keyboard.

    I found a plugin Advanced TinyMCE that can do this on single blogs but Im having trouble when using this on MU because it won't save my settings accross blogs. Each new blogger will have to go and customize their Advanced TinyMCE settings in order for it to work properly.

    Is there a way to hack the actual TinyMCE file instead of using this plugin?

  2. andrea_r
    Moderator
    Posted 14 years ago #

    "TinyMCE won't add <p> tags when I hit enter on my keyboard."

    the < p > tags are there when you hit enter, it just doesn't show them in the editor.

    If they aren't showing on the *front* end of the blog, that's a different issue.

  3. jonperry
    Member
    Posted 14 years ago #

    I have built a page that displays in my side bar, This is where the problem is.

    Users complain that messing with widgets is too hard so I made it so they only have to edit a special page that comes by default with their blog called "sidebar".

    It works great except for the lack of of < p > tags.

    If I look at the source code of my page, all the paragraphs on the main page section of my site have <p> tags when written with WISYWIG but all paragraphs written in my side bar don't have <p> tags unless I put them in manually in HTML view. Strange. Any suggestions?

  4. jonperry
    Member
    Posted 14 years ago #

    here is a link to a blog I created to to show you what is happening. View the site in code view and see what's going on sidebar.actingfaith.com/

  5. andrea_r
    Moderator
    Posted 14 years ago #

    How did you build the page?

    Can you paste the code at pastebin.com and link to it?

  6. jonperry
    Member
    Posted 14 years ago #

    Thanks so much for your help!

    I put my sidebar code here on pastebin here and highlighted the code in question.

    This is the code in question in case you want to see it here too:

    <?php
    $sidebar_page = get_page_by_title('--sidebar--');
    echo "<p>$sidebar_page->post_content</p>";
    ?>

    This code displays the content of a page with a slug of "--sidebar--" in the sidebar.

    The page "--sidebar--". is just a normal page that I set up to come as one of the default pages with every blog. The page is hidden on the menu but you can see the actual page here http://sidebar.actingfaith.com/--sidebar--/

    Somehow the sidebar is not correctly formatting the <p> tags but as you can see, when you view the page "--sidebar--" it formats it correctly.

    Am I missing some code in my sidebar that TinyMCE needs in order to use its formatting.php functions?

    The id for the page is 15 in case that helps.

  7. infoclipper
    Member
    Posted 14 years ago #

    Might try:

    <?php
    $sidebar_page = get_page_by_title('--sidebar--');
    echo apply_filters('the_content', $sidebar_page->post_content);
    ?>

    Although, admittedly, that's also a bit of overkill, as it will run ALL of the content filters. If all you want is some <p> and
    s, you just do:

    <?php
    $sidebar_page = get_page_by_title('--sidebar--');
    echo nl2br($sidebar_page->post_content);
    ?>

  8. jonperry
    Member
    Posted 14 years ago #

    Thanks, that works perfect! You saved me.

About this Topic

  • Started 14 years ago by jonperry
  • Latest reply from jonperry