WordPress.org

Ready to get started?Download WordPress

Forums

Proper markup is achieved how? (6 posts)

  1. dbarbour
    Member
    Posted 8 years ago #

    I've been tasked with creatnig a custom CMS for an intranet site. That's the easy part. The difficult part is properly marking up the text from the database. For instance, if the text in the database is

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut fermentum est at felis. Integer sagittis leo at leo.
    ul>
    li>...../li>
    /ul>

    how does WP turn that into

    p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut fermentum est at felis. Integer sagittis leo at leo./p>
    ul>
    li>...../li>
    /ul>

    Notice that the paragraph tags have been inserted in the proper locations to ensure xhtml validity. I've been trying to develop an algorithm for a little while now and I'm stumped. Perhaps I'm thinking harder than I should? I assume there's a function or collection of functions in WP that I could reference?

  2. Kafkaesqui

    Posted 8 years ago #

    You're looking for wpautop(), in functions-formatting.php (wp-includes/).

  3. dbarbour
    Member
    Posted 8 years ago #

    Excellent! I appreciate the your help. I have but one issue. When running my text through that function, I'm getting a double dose of p> at the beginning of the first block of text. For instance:

    p>p>I’ve been grabbing and storing.../p>

    I can't sort this bugger out either. As it is in the database, there is absolutely nothing before the first character of the paragraph (in this case I). This is simply too much pee. Cursory reviews of the source code reveals nothing obvious. Thoughts?

  4. Kafkaesqui

    Posted 8 years ago #

    I cannot debug what I cannot see. Post code here:

    http://paste.uni.cc

    Reply back with the url you receive.

  5. dbarbour
    Member
    Posted 8 years ago #

    The code is just wpautop() unaltered. The source can be seen at http://paste.uni.cc/8463

  6. Kafkaesqui

    Posted 8 years ago #

    First, sorry for the delay.

    Second, what I was looking for was *your* code, as in how you're trying to put wpautop() to use.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags