Ready to get started?Download WordPress


Preventing automatic paragraph and line break handling (6 posts)

  1. Stevezilla00
    Posted 8 years ago #

    Hello all,

    I'm new to PHP and WordPress in particular. So far things have been going pretty well setting up my WordPress blog, but there's one remaining big issue...

    I use the code view in WordPress for adding new posts, but still WordPress wants to add its own <p> and <br> elements in some places when posts are rendered. One example is using <br> within blockquote elements....WordPress adds its own after each line whether I add them myself or not.

    For the most part, this is just a minor inconvenience that I can work around, but it becomes a big problem when I use <textarea> elements together with dp.SyntaxHighligher to post code snippets. Basically, dp.SyntaxHighligher is a free JavaScript library which reads the contents of marked textareas and converts their contents to ol elements which nicely display code samples. The problem is that by the time dp.SyntaxHighligher gets to it, WordPress has already added a bunch of <p> and <br> elements within the content, rendering the code samples unusable. See, e.g., http://blog.stevenlevithan.com/?p=6

    Can anyone help me figure out how to get around this, or better yet, disable WordPress's auto break/paragraph handling? Thanks muchly.

  2. spoole
    Posted 8 years ago #

    I use the Text Control plugin for this reason.

  3. Stevezilla00
    Posted 8 years ago #

    Spoole, thanks. I'll take a look a that. I've also discovered that I can get WordPress to ignore the contents of the textarea by putting a pre element around it (I consider this a poor hack, though).

  4. manniac
    Posted 7 years ago #

    This plug in may be able help you getting rid of the BRs in textarea-elements:

  5. seanys
    Posted 7 years ago #

    So... TextControl's options operate on posts at the time they are inserted in the database?

    As opposed to when the post is viewed?

Topic Closed

This topic has been closed to new replies.

About this Topic