• 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 page, after header

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 page, after header

This topic is: not resolved
  • This topic has 5 replies, 3 voices, and was last updated 10 years ago by Jon Bellah.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • January 15, 2013 at 7:44 am #12031
    fireflyloft
    Member

    I am working on my first custom theme. I would like to add the featured image to each page so that it displays under the header but before the content/sidebar. I am having trouble figuring out how to get the featured image to show up on the pages. Can anyone help?

    Thanks!!

    January 15, 2013 at 8:53 am #12045
    Jon Bellah
    Member

    Add this to your functions.php file:

    add_action('genesis_after_header', 'child_custom_images');
    function child_custom_images() { ?>
    <!-- Add your HTML here -->
    <?php }
    

    Follow me on the Twitters at @JonBellah. I blog about web design, development and a lot about Genesis at CSSForge.com

    January 15, 2013 at 8:56 am #12047
    Darren
    Member

    Hi John - thanks for code. Will this also work on getting the featured image to display on blog posts?

    January 15, 2013 at 9:00 am #12049
    Jon Bellah
    Member

    Ah, I misread the original question, actually. The code above is to display a presumably static image. In order to add a featured image below the header to blog pages, the code would look like:

    add_action('genesis_after_header', 'child_custom_images');
    function child_custom_images() {
    if (is_single()) { ?>
    <?php 
    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
      the_post_thumbnail();
    } ?>
    <?php }}
    

    This code will only display on post pages, and will check to see if the post has a thumbnail (featured image) assigned to it. If it does, it will display it. If it does not, it will not display anything.


    Follow me on the Twitters at @JonBellah. I blog about web design, development and a lot about Genesis at CSSForge.com

    January 15, 2013 at 9:21 am #12050
    fireflyloft
    Member

    Whoo hoo!! Thanks so much for your help. 🙂

    January 15, 2013 at 9:29 am #12051
    Jon Bellah
    Member

    No problem! Glad I could help. 🙂


    Follow me on the Twitters at @JonBellah. I blog about web design, development and a lot about Genesis at CSSForge.com

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 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

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