• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Problem with Featured Images in Going-Green

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Problem with Featured Images in Going-Green

This topic is: not resolved

Tagged: Featured Images "Going Green"

  • This topic has 6 replies, 3 voices, and was last updated 12 years, 4 months ago by gfalken.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • August 26, 2013 at 8:38 am #58858
    bigfish
    Participant

    I know this topic has been covered several times before, but the solutions don't seem to exist in the functions.php file I downloaded with the theme, so I'm not sure if it was updated for recent downloads.

    Anyway, I am seeing an image show up before the headline of my posts. This is fine if I select a "Featured Image" but if I don't select an image to be featured, the theme is selecting a random image in the post and displaying it (again) above the headline. I don't want any image to be shown up there.

    For example, here's a page that is wrong: http://coolandcollected.com/original-frank-miller-dark-knight-cover-art-sells-for-478000/

    There should not be an image above the headline. No images were selected as "Featured Image."

    The functions.php that came with the theme has this code:

    //* Add featured image above the entry content
    add_action( 'genesis_entry_header', 'going_green_featured_photo', 5 );
    function going_green_featured_photo() {
    if ( is_page() || ! genesis_get_option( 'content_archive_thumbnail' ) )
    return;

    if ( $image = genesis_get_image( array( 'format' => 'url', 'size' => genesis_get_option( 'image_size' ) ) ) ) {
    printf( '<div class="featured-image">%s</div>', $image, the_title_attribute( 'echo=0' ) );
    }
    }

    I'm sure there's a simple solution to this, but I just don't know it! Thanks in advance.

    August 31, 2013 at 4:56 am #59864
    Sridhar Katakam
    Participant

    Can you paste the full code present in child theme's functions.php at http://www.pastebin.com and give us a link?


    Genesis Tutorials | Follow me on Twitter

    September 5, 2013 at 8:15 am #60832
    bigfish
    Participant

    Here's a link to the entire functions.php

    http://pastebin.com/giJSHmmw

    September 5, 2013 at 9:21 am #60848
    Sridhar Katakam
    Participant

    Try deleting

    //* Remove default post image
    remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
    
    //* Add featured image above the entry content
    add_action( 'genesis_entry_header', 'going_green_featured_photo', 5 );
    function going_green_featured_photo() {
    	if ( is_page() || ! genesis_get_option( 'content_archive_thumbnail' ) )
    		return;
    
    	if ( $image = genesis_get_image( array( 'format' => 'url', 'size' => genesis_get_option( 'image_size' ) ) ) ) {
    		printf( '<div class="featured-image"><img src="%s" alt="%s" /></div>', $image, the_title_attribute( 'echo=0' ) );
    	}
    }

    Genesis Tutorials | Follow me on Twitter

    September 5, 2013 at 10:00 am #60857
    bigfish
    Participant

    Removing that bit of code did remove the featured image from appearing above the headline, but that's not exactly what I was hoping for.

    I want the featured image to appear above the headline IF there is a selected feature image. If there is no feature image selected within a post, there should not be an image appearing above the headline. The original code seems to select an image from the post to use as the featured image, which results in the same image appearing twice, once above the headline and second time within the post, as it should.

    September 5, 2013 at 10:43 am #60877
    Sridhar Katakam
    Participant
    <?php if (has_post_thumbnail()) { ?>
    	<div class="my-featured-image">
    		<?php the_post_thumbnail('my-featured-image'); ?>
    	</div>
    <?php } ?>

    is a generic code that will check for the presence of post thumbnail and if present, display it. 'my-featured-image' would be the image size that can be defined via add_image_size().

    In http://pastebin.com/giJSHmmw try replacing

    if ( $image = genesis_get_image( array( 'format' => 'url', 'size' => genesis_get_option( 'image_size' ) ) ) ) {
    		printf( '<div class="featured-image"><img src="%s" alt="%s" /></div>', $image, the_title_attribute( 'echo=0' ) );
    	}

    with the above code.


    Genesis Tutorials | Follow me on Twitter

    September 14, 2013 at 1:13 pm #62553
    gfalken
    Member

    I fixed this by changing the first IF statement in function going_green_featured_photo() to

    if ( ! has_post_thumbnail() || (is_page() || ! genesis_get_option( 'content_archive_thumbnail' )) )
    	return;
  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble