Sunday, June 19, 2011

post without image

place this code in functions.php in your theme folder.
function post_without_image($content) {
    echo $content;
    $postOutput = preg_replace('/<img[^>]+./','', ob_get_contents());
    return $postOutput;

use post_without_image() function with 1 parameter with your content anywhere you want

<?php echo post_without_image($content); ?>

Instead of $content we use content variable where we store our content section. That's done.

No comments:

Post a Comment