Excluding images from content loop
-
So I’ve made some recent changes to our theme that pretty much requires me to either go through our 700+ posts and remove every image our find someone to exclude images from displaying with the rest of the content. I found this a few weeks ago:
<?php $content = get_the_content(); $postOutput = preg_replace(' /<img[^>]+./ ','', $content); echo $postOutput; ?>
It handles the job just find, except it also kills all spacing for paragraphs and most formatting. Anyone have any suggestions that doesn’t involve me rummaging through posts three years old? Any guidance would be much much much appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Excluding images from content loop’ is closed to new replies.