• Hi,
    I’d like to remove the featured image on the homepage. I want to keep the featured image for “Related Posts” but I do not want the featured image to show up on blog posts or the homepage.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi

    You can do it by adding a conditional.

    You can do this by adding the following codes to the theme’s content.php file. Here I would suggest you to make the changes using child theme, so that this change along with other changes made will stay preserved even after theme updates

    change line number 22 which now looks like
    <?php if ( has_post_thumbnail() ) : ?>

    to

    <?php if ( has_post_thumbnail() && ! is_home() ) : ?>

    Hope it helps!!

    Thanks

    Thread Starter carolinereusen

    (@carolinereusen)

    Hello,
    I don’t see that line 22, this is what I see instead:
    <?php if ( has_post_thumbnail() ) : ?>

    I tried changing it to what you said, but it did not work.

    did you try changing it to

    <?php if ( has_post_thumbnail() && ! is_home() ) : ?>

    Thread Starter carolinereusen

    (@carolinereusen)

    Yes I changed <?php if ( has_post_thumbnail() ) : ?> to <?php if ( has_post_thumbnail() && ! is_home() ) : ?> and then some syntax error showed up on the homepage after.

    I have tried it and it worked for me. Please check the syntax.

    It would be better if you just copy paste the whole thing there, or paste the code from your file in pastebin and share a link.

    Thread Starter carolinereusen

    (@carolinereusen)

    This is the copy of the content.php:

    <?php
    /**
    * @package aThemes
    */
    ?>

    <article id=”post-<?php the_ID(); ?>” <?php post_class( ‘clearfix’ ); ?>>
    <header class=”entry-header”>
    <h2 class=”entry-title”>” rel=”bookmark”><?php the_title(); ?></h2>

    <?php if ( ‘post’ == get_post_type() ) : ?>
    <div class=”entry-meta”>
    <?php athemes_posted_on(); ?>

    <?php if ( ! post_password_required() && ( comments_open() || ‘0’ != get_comments_number() ) ) : ?>
    <span class=”comments-link”> <?php comments_popup_link( __( ‘Leave a Comment’, ‘athemes’ ), __( ‘1 Comment’, ‘athemes’ ), __( ‘% Comments’, ‘athemes’ ) ); ?></span>
    <?php endif; ?>
    <!– .entry-meta –></div>
    <?php endif; ?>
    <!– .entry-header –></header>

    <?php if ( has_post_thumbnail() ) : ?>

    <div class=”entry-thumbnail”>
    ” title=”<?php the_title_attribute(); ?>” >
    <?php the_post_thumbnail( ‘thumb-featured’ ); ?>

    </div>
    <?php endif; ?>

    <?php if ( ( is_search() && get_theme_mod(‘athemes_search_excerpt’) ==” ) || ( is_home() && get_theme_mod(‘athemes_home_excerpt’) ==” ) || ( is_archive() && get_theme_mod(‘athemes_arch_excerpt’) ==” ) ) : ?>
    <div class=”entry-summary”>
    <?php the_excerpt(); ?>
    <!– .entry-summary –></div>
    <?php else : ?>
    <div class=”clearfix entry-content”>
    <?php the_content( __( ‘Continue Reading <span class=”meta-nav”>→</span>’, ‘athemes’ ) ); ?>
    <?php wp_link_pages( array( ‘before’ => ‘<div class=”page-links”>’ . __( ‘Pages:’, ‘athemes’ ), ‘after’ => ‘</div>’ ) ); ?>
    <!– .entry-content –></div>
    <?php endif; ?>

    <footer class=”entry-meta entry-footer”>
    <?php if ( ‘post’ == get_post_type() ) : ?>
    <?php
    $categories_list = get_the_category_list( __( ‘, ‘, ‘athemes’ ) );
    if ( $categories_list && athemes_categorized_blog() ) :
    ?>
    <span class=”cat-links”>
    <?php printf( __( ‘<i class=”ico-folder”></i> %1$s’, ‘athemes’ ), $categories_list ); ?>
    </span>
    <?php endif; ?>

    <?php
    $tags_list = get_the_tag_list( ”, __( ‘, ‘, ‘athemes’ ) );
    if ( $tags_list ) :
    ?>
    <span class=”tags-links”>
    <?php printf( __( ‘<i class=”ico-tags”></i> %1$s’, ‘athemes’ ), $tags_list ); ?>
    </span>
    <?php endif; ?>
    <?php endif; ?>
    <!– .entry-meta –></footer>
    <!– #post-<?php the_ID(); ?>–></article>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Removing Featured Image on Homepage’ is closed to new replies.