Differentiating between P tags wrapping images and P tags wrapping text nodes in Wordpress?


I need a good solution to be able to style

tags differently in a wordpress post. More specifically I need to differentiate between paragraphs and images. Wordpress just wraps all new lines in


Here are some possibilities:

  • Strip all

    tags and add

    tags where appropriate (around text)
  • Add a class on

    tags that wrap text
  • Somehow differentiate between them as is (p img does not work.. I need to select the p tags that have a img child... I'd rather not use selectors that don't work in IE 6)
  • Other solutions?

I do not want blog contributors to have to do something manually (add div tags), I want this done in the background.

I know other people are having problems with this. Please let me know your thoughts!

Thanks all, Matt Mueller