I have a Wordpress post which I would like to strip the images and text content out in 2 separate parts. I wan't to be able to control both elements separately.
current attempt
<?php
$content = wpautop($content); // Add paragraph-tags
$content = str_replace('<p></p>', '', $content); // remove empty paragraphs
$content = preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); // remove paragraphs around img tags
echo $content;
?>
I was able to put
tags on the content but ot sure how to take out elements and bring each type back