• 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

"Featured Image" for Homepage when Shared

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 › "Featured Image" for Homepage when Shared

This topic is: resolved
  • This topic has 10 replies, 3 voices, and was last updated 11 years, 8 months ago by Carlo.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • January 8, 2015 at 1:17 pm #136410
    Kary
    Member

    Hi all...not seeing anything that answers this question. Is there a way to set a specific image (like the logo) that will shared when the main site's URL is shared via social media.

    I know there is a way to do this in the meta tags, but that designates a specific image for the entire site. I just want to be able to set a pre-determined image for the homepage. Since it is a page that is dynamically created, sometimes (often times) the image that gets pulled by sites like Facebook isn't always the one you want.

    January 9, 2015 at 4:13 pm #136791
    Shawberry Themes
    Member

    Hello Kary!

    I have been successful doing this by going to the Home Page and designating a featured image. Have you tried that?

    Shawna B.
    http://www.busymomibeeblogdesigns.com

    January 10, 2015 at 5:28 am #136840
    Carlo
    Member

    You can have the meta tags only show on the front page. You'd use something like this:

    add_action( 'wp_head', function() {
    	if ( is_front_page() )
    		echo '<meta name="" content="">';
    } );

    Comprehensive, easy to follow Genesis documentation

    January 12, 2015 at 8:10 am #137169
    Kary
    Member

    Hi Shawna, it would work perfectly except my theme doesn't actually have a home page that I created. So I would have to do that somehow on the template file.

    Thanks Carlo, someone else pointed me to GitHub snippet. https://gist.github.com/callingmedic911/22fa7f8071f69232d640
    It is a similar idea to your function.

    I know little about writing a function code that won't break the theme. So I inserted the one from GitHub (Below) using Dreamweaver and received an error and of course deleted before saving. Something was wrong with that code. So I'll see if I can get your's to work. Thanks so much.

    medic_home_og() {
      if ( is_home() )
        echo '<meta property="og:image" content="http://link/to/your/og/image/file" />';
    }
    add_action( 'wp_head', 'medic_home_og', 5);
    January 12, 2015 at 8:23 am #137172
    Kary
    Member

    Okay...not working. I believe its because the theme I'm using (Parallax Pro) you don't actually set a static homepage for the "home page." You simply start filling in the widgets and the home template becomes active.

    The code if ( is_front_page() ) is looking for a static homepage that I would have set in my WP admin area.

    Does anyone have an idea as to how to get this function to work on a theme like the one I'm using?

    January 12, 2015 at 8:29 am #137173
    Kary
    Member

    It doesn't appear if ( is_home() ) works either. Neither of these add an image to my og: image meta tag. I checked in two ways. I physically looked at my source code. And for grins, I went to the Facebook debugger to see what image(s) it pulls up for the og:image meta tag. The image I have designated does not appear.

    Facebook debugger

    January 12, 2015 at 8:48 am #137174
    Kary
    Member

    Is there a function I can write that uses the front-page.php? I am not good at writing functions code. But instead of if ( is_front_page() ) would a genesis hook specific to the front-page.php work?

    parallax_home_genesis_meta

    January 12, 2015 at 9:58 am #137177
    Carlo
    Member

    Hi Kary. The reason you got a Dreamweaver error is because your code did not declare the function. Try this:

    function medic_home_og() {
      if ( is_front_page() )
        echo '<meta property="og:image" content="http://link/to/your/og/image/file" />';
    }
    add_action( 'wp_head', 'medic_home_og', 5);

    I also changed is_home() to is_front_page() because is_home() is for the latest posts index regardless of whether it's the front page. is_front_page() is for the front page regardless of whether it's a static page or your latest posts.


    Comprehensive, easy to follow Genesis documentation

    January 12, 2015 at 10:36 am #137190
    Kary
    Member

    Unfortunately, it still is not working for me. This is the code I've uploaded via my functions file

    function medic_home_og() {
      if ( is_front_page() )
        echo '<meta property="og:image" content="http://techiemuse.com/wp-content/uploads/2015/01/TechieMuse.png" />';
    }
    add_action( 'wp_head', 'medic_home_og', 5);

    When I check this site, the image does not appear. I have clicked the "rescrape" button. https://developers.facebook.com/tools/debug/

    Someone else suggested to try if ( is_home() || is_front_page() )as the conditional statement. But this isn't working for me either.

    January 12, 2015 at 11:14 am #137198
    Kary
    Member

    Okay...got it to work finally. Thanks for your help. This is the code that I used and I am finally able to see the image in the Facebook debugger.

    function change_home_og() {
      if ( is_home() || is_front_page() )
        echo '<meta property="og:image" content="http://techiemuse.com/wp-content/uploads/2015/01/TechieMuse.png" />';
    }
    add_action( 'wp_head', 'change_home_og', 5);

    For anyone who wants to do this, make absolutely certain your image is 200x200 or Facebook will pull something else from the page that is that size. Not sure if it can be a large (square) image. But the 200x200 definitely worked for me.
    FB debugger

    January 14, 2015 at 3:37 am #137400
    Carlo
    Member

    I'm glad you got it to work Kary. I still think that if ( is_front_page() ) is better than if ( is_home() || is_front_page() ) because there's a chance that using if ( is_home() || is_front_page() ) will cause your facebook image to show on another page other than the front page, depending on how your site is configured. But that's up to you.


    Comprehensive, easy to follow Genesis documentation

  • Author
    Posts
Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘"Featured Image" for Homepage when Shared’ 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

© 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