• 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

Add featured Image To Posts

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 › Design Tips and Tricks › Add featured Image To Posts

This topic is: not resolved

Tagged: Balance, featured image

  • This topic has 10 replies, 3 voices, and was last updated 7 years, 6 months ago by nathaniell.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • December 6, 2014 at 1:58 pm #133843
    nathaniell
    Participant

    Hi Guys,

    I'm using the Balance child theme. I'm trying to add a featured image to my posts, as in this one here: http://brew7.com/do-you-really-need-a-5000-ml-erlenmeyer-flask/

    I got the featured image working on the home page (http://brew7.com/) for the featured post, and basically want the same thing for the actual post.

    I tried to use the code here: http://sridharkatakam.com/adding-featured-images-post-titles-minimum-pro/ but couldn't get it to work. The code I added to my theme so far is this:

    //* Add new image sizes
    add_image_size('grid-thumbnail', 536, 150, TRUE);
    add_image_size('single-thumbnail', 720, 250, TRUE);
    
    add_action ( 'genesis_entry_header', 'sk_show_featured_image_single' );
    function sk_show_featured_image_single() {
    	if ( is_single() && has_post_thumbnail() ) {
    		echo '<div class="single-thumbnail">';
    		genesis_image( array( 'size' => 'single-thumbnail' ) );
    		echo '</div>';
    	}
    }

    I'm a beginner at this stuff. I can copy/paste without messing up my site, but as far as the actual code goes, I'm pretty lost.

    Any suggestions or help is welcome!

    http://brew7.com
    December 6, 2014 at 3:38 pm #133851
    anotherusername
    Member

    Just thinking out loud here...

    I wonder if your theme has the genesis_entry_header hook on your single posts / pages or not...

    I thought that hook was added with HTML5 (and balance theme doesn't appear to be html5).

    But if it works on your home page, but not on your single pages, then maybe it isn't in the singles template???

    December 6, 2014 at 5:03 pm #133856
    nathaniell
    Participant

    I see that balance is not html5. The code that I showed above didn't change the home page featured post, I just edited some code in the grid loop section from "0" to "large".

    December 6, 2014 at 11:03 pm #133864
    anotherusername
    Member

    Ok, for a test, just try this:

    Substitute this:

    genesis_before_post_content

    in place of this:

    genesis_entry_header

    In this line:

    add_action ( 'genesis_entry_header', 'sk_show_featured_image_single' );

    so instead it will read:

    add_action ( 'genesis_before_post_content', 'sk_show_featured_image_single' );

    And see if that at least SHOWS the image (even if it isn't in the exact right place).

    Then let us know and we can try and take it from there.

    December 6, 2014 at 11:23 pm #133866
    Brad Dalton
    Participant

    Try this http://wpsites.net/web-design/display-featured-image-before-or-after-entry-title-on-single-posts-pages/


    2700 Genesis Tutorials

    December 7, 2014 at 6:26 pm #133935
    nathaniell
    Participant

    Thanks Brad, that did it. I had seen that post before but didn't realize my theme was xhtml and was using the html5 before. Oops! (Thanks to everyone else that posted an answer as well)

    One follow up question for anyone:

    How do I get the featured image to fill/crop to a uniform space size? I'd like to be able to add a featured image and just have it be uniformly sized across posts so I don't have to pre-measure each time.

    December 7, 2014 at 10:10 pm #133947
    Brad Dalton
    Participant

    The size is set in the Genesis > Theme Settings > Content Archives settings.

    This is the part of the code which does that

    'size' => genesis_get_option( 'image_size' ),
    

    Is that what you mean by uniformly sized across posts?


    2700 Genesis Tutorials

    December 7, 2014 at 10:48 pm #133953
    nathaniell
    Participant

    Sorry, I should have included links.

    You can see in the links below that each feature image has retained it's original size and shape. I'd like to have ALL the images fill about a 620x230 space regardless of what their upload size is.

    http://brew7.com/stout-tasting-1-samuel-smiths-rogue-belhaven-shipyard/
    http://brew7.com/libbey-craft-beer-glass-set-review/
    http://brew7.com/is-the-rogue-left-hand-stout-glass-worth-your-money/

    December 7, 2014 at 11:21 pm #133954
    Brad Dalton
    Participant

    Try this http://wpsites.net/wordpress-admin/how-to-add-custom-image-sizes-in-wordpress/


    2700 Genesis Tutorials

    December 8, 2014 at 8:23 pm #134038
    nathaniell
    Participant

    That does add the ability to change an image size that's uploaded to the post, but it doesn't change the size of the featured image. In his example, the "featured image" is just a selection like 'full size' or 'thumbnail'.

    For example, if I choose "set featured image" and choose an image, it doesn't allow me to choose thumbnail, medium, full size, or any custom image sizes. It just takes the image as-is.

    A good example of what I'm trying to do is here: http://www.ivetriedthat.com/

    December 8, 2014 at 8:46 pm #134040
    nathaniell
    Participant

    Just continuing to read up on this, and I think the term I'm looking for is "hard crop". I want to have featured images resized and hard cropped to 620x230

  • Author
    Posts
Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Design Tips and Tricks’ 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

© 2022 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