WordPress.org

Support

Support » How-To and Troubleshooting » Removing featured image from single post

Removing featured image from single post

  • ProbablyBest
    Member

    @probablybest

    I am displaying a featured image on my blog page, however once I click through to an individual post it displays the featured image there as well. Is there a way to stop the featured image displaying on the single post? By editing perhaps content.php or functions.php?

    You can view an example of what I mean here http://thesaucemag.com/sauce/chocoholic-in-the-city/

    I could hide it via CSS but I would rather not have to do it that way.

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • esmi
    Forum Moderator

    @esmi

    Where did you download this theme from?

    ProbablyBest
    Member

    @probablybest

    Its not downloaded, its a custom theme.

    esmi
    Forum Moderator

    @esmi

    Where did you obtain the theme from?

    ProbablyBest
    Member

    @probablybest

    its using the basic twenty thirteen functions.php but the rest is custom.

    esmi
    Forum Moderator

    @esmi

    Where did you obtain the theme from?

    ProbablyBest
    Member

    @probablybest

    I dont know how else to answer this questions. I build websites. It is a custom HTML & CSS theme, using a bootstrap grid that. I designed it in photoshop. It is using a basic twentythirteen functions.php.

    Michael
    Forum Moderator

    @alchymyth

    http://codex.wordpress.org/Template_Hierarchy

    if the theme is based on Twenty Thirteen, then a single post will use single.php, which in turn will call content.php which contains the code for the featured image. https://codex.wordpress.org/Post_Thumbnails

    to avoid the featured image being shown on single posts, you will need to wrap that code into a if( !is_single() ) conditional statement.

    however, as your theme is a custom development, this is just a guess, as you are the only one with full access to the files.

    ProbablyBest
    Member

    @probablybest

    I think that could be the answer? Whats the best way to wrap an if statement in another if statement?

    <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
    		<div class="entry-thumbnail">
    			<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
    				<?php the_post_thumbnail('full', array('class' => 'img-responsive'));   ?>
    			</a>
    		</div>
    		<?php endif; ?>
    Michael
    Forum Moderator

    @alchymyth

    try

    <?php if ( has_post_thumbnail() && ! post_password_required() && !is_single() ) : ?>

    ProbablyBest
    Member

    @probablybest

    spot on! Thank you for your help 🙂

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Removing featured image from single post’ is closed to new replies.