• Hi,

    I have set up my own child theme under Thematic (parent theme). My problem is a simple one to do with the HTML editor of WordPress (I think).

    Regarding WordPress “pages”, when I add/edit a page, WordPress automatically strips out extra line breaks and adds its own markup. Even under the HTML tab of the editor, WordPress still adds its own <p> tags and removes extra line breaks. So if you add an image for example, the text automatically wraps around it when what you really want is the text to be placed below it (simple example).

    I found that adding the following code to my functions.php disables this:
    remove_filter (‘the_content’, ‘wpautop’);

    However with the above, you get good control on the HTML, but the end user is going to be the client (not HTML savvy), not me.

    Therefore, what is a common solution to this? Should the developer (me) disable the wpautop setting and ask the client to use the editor in its basic mode, and contact me if further styling help is required?

    Or should I update the CSS or any setting somehow so that the editor of WordPress can be used in its full form and I just need to optimise my code somehow?

    Many thanks,
    Rishi

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Rishi,

    I see your problem. We had a very similar issue in few of our previous projects in MULTIDOTS. WordPress will trim all the p and br tags from the content, that’s weird I know.

    We have fixed the problem by using this plugin. I am sure this will be fit to your needs.

    http://wordpress.org/extend/plugins/tinymce-advanced/

    Once you will install this plugin, under settings of the TinyMCE Advanced you will find an options where you can stop removing this.

    Stop removing the P and BR tags when saving and show them in the HTML editor.

    Let me know if this works.

    Thread Starter rishijd

    (@rishijd)

    Hi,

    Thanks for this! It does help, the extra BR and P tags are not removed which definitely helps. WordPress / TinyMCE does still automatically add its own P tags even if you edit in HTML mode, but at the moment that isn’t a big deal since it can be fine tuned in CSS. (Or in the worst case, the remove_filter function above can be used in functions.php).

    Thanks very much for your help!
    Rishi

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Editor strips extra line breaks and adds its own tags’ is closed to new replies.