WordPress.org

Ready to get started?Download WordPress

Forums

Removing featured image from single post (11 posts)

  1. ProbablyBest
    Member
    Posted 8 months ago #

    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!

  2. esmi
    Forum Moderator
    Posted 8 months ago #

    Where did you download this theme from?

  3. ProbablyBest
    Member
    Posted 8 months ago #

    Its not downloaded, its a custom theme.

  4. esmi
    Forum Moderator
    Posted 8 months ago #

    Where did you obtain the theme from?

  5. ProbablyBest
    Member
    Posted 8 months ago #

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

  6. esmi
    Forum Moderator
    Posted 8 months ago #

    Where did you obtain the theme from?

  7. ProbablyBest
    Member
    Posted 8 months ago #

    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.

  8. alchymyth
    The Sweeper & Moderator
    Posted 8 months ago #

    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.

  9. ProbablyBest
    Member
    Posted 8 months ago #

    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; ?>
  10. alchymyth
    The Sweeper & Moderator
    Posted 8 months ago #

    try

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

  11. ProbablyBest
    Member
    Posted 8 months ago #

    spot on! Thank you for your help :)

Reply

You must log in to post.

About this Topic