Support » Fixing WordPress » Wrap all <p> after the first </p> in a a div?

  • artfulalibi



    I’d like to wrap all my content after the first <p></p> in a div. Anyone have any idea how I could go about doing this?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Sammy Russo


    can you give us a little more information about what the end goal is?

    for most themes all the content is wrapped in a div class=”post” id=”post-id#”.

    in every post.. WP auto wraps each paragraph with the appropriate <p></p> tags..

    with this said.. a little more inside details would help us understand why you are trying to do what you asked so we can help.

    I’ll be on for another hour or so..




    I know how the data is normally wrapped. My end goal is to show the first paragraph of each post on the index, and using some nice jquery script, allow the user to expand the panel to see the full story. This requires wrapping everything after the first </p> in a <div>.



    Just let jQuery do the work. Have it find the <p> elements in all of the post divs… after the first one, insert your opening div tag and some CSS classes and then after the final one (or :before the next post div), add the closing div tag. Then you can manipulate that created div element any way you wish.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wrap all <p> after the first </p> in a a div?’ is closed to new replies.