How To Hide Image? (3 posts)

  1. JVWest
    Posted 7 years ago #

    Hello everyone!

    I would like to have a category in which all posted images are hidden from view until the viewer actually clicks on the post itself. Or something very similar to that.

    The point is to keep certain images from displaying automatically while allowing images in other categories to display normally.

  2. esmi
    Forum Moderator
    Posted 7 years ago #

    One approach would be to create a category template for this category that uses the_excerpt() rather than the_content(). The latter would automatically strip all formatting and images from the post summary text in the catgeory listing.


    You'd also need to edit your index.php page to handle posts from this category different using something like:

    <?php if(in_category('Special')) the_excerpt;
    else the_content();?>;

    instead of the standard <?php the_content();?>.

  3. JVWest
    Posted 7 years ago #

    Thank you. I'll give that a try!

Topic Closed

This topic has been closed to new replies.

About this Topic