• 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 at top of single blog post in Genesis

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 at top of single blog post in Genesis

This topic is: resolved

Tagged: featured image, featured image below post, php

  • This topic has 1 reply, 2 voices, and was last updated 8 years ago by Victor Font.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • November 3, 2017 at 9:00 am #213231
    newedgemarketing
    Member

    Hi I am desperately tryin to add a featured image to the top of my blog posts below the title.

    I originally used this bit of code:

    Add Featured Image On Single Posts

    add_action( 'genesis_entry_header', 'single_post_featured_image', 15 );

    function single_post_featured_image() {

    if ( ! is_singular( 'post' ) )
    return;

    $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image' ) ) );
    printf( '%s', get_permalink(), the_title_attribute( 'echo=0' ), $img );

    }

    which worked except it the featured image was a clickable link - which i don't want.

    I then changed it to this:

    Add Featured Image at top of Single Post/Page in Genesis

    add_action( 'genesis_entry_content', 'themeprefix_featured_image', 1 );
    function themeprefix_featured_image() {
    $add_single_image = get_theme_mod( 'themeprefix_single_image_setting', true ); //sets the customizer setting to a variable
    $image = genesis_get_image( array( // more options here -> genesis/lib/functions/image.php
    'format' => 'html',
    'size' => 'large',// add in your image size large, medium or thumbnail - for custom see the post
    'context' => '',
    'attr' => array ( 'class' => 'aligncenter' ), // set a default WP image class

    ) );
    if ( is_singular() && ( true === $add_single_image ) ) {
    if ( $image ) {
    printf( '<div class="featured-image-class">%s</div>', $image ); // wraps the featured image in a div with css class you can control
    }
    }
    }

    Which i thought had worked finally the image wasn't a link.

    But this tutorial only partially worked as it added an image (any image) to the top of every single page or post even the home page. Which looked a complete mess.

    I am at a loss. I don't know why this is so hard but could someone please help? I'm sure each of these could be modified but i am not a developer, so it's pretty much double dutch to me.

    https://stevemayall.com
    November 3, 2017 at 11:11 am #213240
    Victor Font
    Moderator

    Glad you figured it out.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Add featured Image at top of single blog post in Genesis’ is closed to new replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

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