• patbrumfield

    (@patbrumfield)


    i’m trying to make a post that has an image first then text, and i want the image to not be wrapped in paragraph tags. i have found all sorts of hacks and plugins to remove all p tags from posts, but nothing about just the first one. Is this even possible? or am i relegated to removing all p tags, and inputting them manually, only where i need them?

Viewing 5 replies - 1 through 5 (of 5 total)
  • richarduk

    (@richarduk)

    How about using the code editor which is a tab beside the visual editor, and just manually removing the one <p> tag?

    Thread Starter patbrumfield

    (@patbrumfield)

    the code editor doesn’t give the option to remove/add <p> tags, wordpress uses a function called “autop” to add in <p> tags where it think you’ll want them. most of the time it’s correct, but in this instance i’m trying to get around it…

    i’m guessing that i can hack the autop function, although that truly is beyond me.

    richarduk

    (@richarduk)

    A quick and dirty workaround is simply to surround the image with div tags. You can give them a class to float left or right etc. although the div tag alone prevents WP adding p tags.

    It’s a pain ….

    More of the same here …
    https://www.ads-software.com/support/topic/86982?replies=12

    Thread Starter patbrumfield

    (@patbrumfield)

    @rickarduk – excellent, thank you for the assistance, your workaround worked like a charm.

    cheers.

    I have the same problem with the <DIV> and <SCRIPT> tags. There are always surrounded by <p> tags and this is causing validation errors.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do i remove the first p tag from a post?’ is closed to new replies.