• I would like to know if there is a way to remove the <p> wich the default WordPress post renderer (with WPAutoP I guess) puts around an image inside a post. I used the Disable WPAUTOP Plugin but it seems to disable all <p> in a post. I want to remove the <p> WordPress puts around an image, but to preserve the <p> it puts around text.

    With Disable WPAUTOP Plugin no matter how many “ENTER”s I put before the text, I won’t get a <p> tag around it. The only way around this is to use the plugin and then put the <p> around the text on the HTML code. This is no good for me as this site will be used by a client wich have him to code HTML, even a simple <p>, would be asking too much of him.

    What I want to achieve with this is a post wich has an image that comes in the left part of the post <div> and then the post title and behind the post tilte the post text. I got the_title() and the_content() inside the same <div> and floating everything just right, it does function if I have the post coded the way I need. But the <p> around the image will have my floats go all wrong and breaks my design.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey there. If you just wrap the image in another block level element, you should be good. In your post:

    <div><img src="?" alt="whatever" /></div>

    That will prevent your image from being wrapped in a paragraph tag. You may want to give the image a special class to have it do what you want, but I don’t know what your special use case is, so I’m not sure.

    Thread Starter filipeabreu

    (@filipeabreu)

    Thanks Nick.

    I am aware of this <div> trick you mentioned, I use it very often in my personal bolg. But the fact is that I have to do this automagically, with a plugin or a argument to the the_content() function (don’t really know if there any argument to this function). I can’t have the authors to code anything, as they know anything about it (having them to use a blog system is already asking too much). They are the kind of person who suffer just to send an email, asking them to <div> a image is like asking you and me to make a tutorial about brain surgery (you don’t happen to be a neurologist, do you? ??

    I am taking a look at the Post-Image plugin, wich I didn’t find in the official WP plugin repository, but a link to it was found in a post in this forum.

    Thanks.

    Any updates on this problem? Any solutions?

    Thanks for the <div> trick suggestion. It was one of the last wordpress quirks I didn’t quite know how to get around.

    zakkap

    (@zakkap)

    surely there most be a better way. i’m off to find it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Paragraph <p> around image on a Post’ is closed to new replies.