title: Isolating images and content
body: <p>I'm looking to separate the text and images in my Wordpress post. I want to be able to put them in different areas on my page.</p>
  
  <p>I currently have only been able to get the content in <p> tags but can't isolate and separate the content.</p>
  
  <p>current html</p>
  
  <pre><code>&lt;?php
    $content = wpautop($content); // Add paragraph-tags
    $content = str_replace('&lt;p&gt;&lt;/p&gt;', '', $content); // remove empty paragraphs
    $content = preg_replace('/&lt;p&gt;\s*(&lt;a .*&gt;)?\s*(&lt;img .* \/&gt;)\s*(&lt;\/a&gt;)?\s*&lt;\/p&gt;/iU', '\1\2\3', $content); // remove paragraphs around img tags
    echo $content;
  ?&gt;
  </code></pre>