• Greetings,

    I’m using the following snippet

    <?php
       ob_start();
       the_content('Read the full post',true);
       $postOutput = preg_replace('/<img[^>]+./','', ob_get_contents());
       ob_end_clean();
       echo $postOutput;
    ?>

    to hide images from the main page but I’m then calling my images back in a separate div right next to my post but it pulls the captions from below the images to the body of the post. Is there anyway to hide images in a simpler manner so that all of text isn’t being dragged into the same area?

    Sorry if this is too vague.

    The reason I’m calling the images separately into a div next to the post is because I’m working on a horizontal layout. If anyone has any suggestions, that would help.

    Thank you.

The topic ‘Hide or Remove images from main post.’ is closed to new replies.