• Resolved DavidB1984

    (@davidb1984)


    I know this question has been asked before, but the solutions posted don’t work for me.

    I’m using Genesis with the FoodiePro child theme. I want to add the following open graph meta tags to the head of my homepage only:

    <meta property=”og:title” content=”Sentence Spotlight” />
    <meta property=”og:site_name” content=”Sentence Spotlight” />
    <meta property=”og:url” content=”sentencespotlight.com” />
    <meta property=”og:description” content=”I pick good sentences and think about why they work.” />
    <meta property=”og:image” content=”https://www.theperfectpoach.com/wp-content/uploads/2015/03/Sentence-Spotlight-Logo.jpg&#8221; />

    FoodiePro doesn’t have its own header.php, so I copied the header.php from Genesis, and added the following php code:

    if (is_front_page() ) {
    echo “<meta property=”og:title” content=”Sentence Spotlight” />
    <meta property=”og:site_name” content=”Sentence Spotlight” />
    <meta property=”og:url” content=”www.sentencespotlight.com” />
    <meta property=”og:description” content=”I pick good sentences and think about why they work.” />
    <meta property=”og:image” content=”https://www.theperfectpoach.com/wp-content/uploads/2015/03/Sentence-Spotlight-Logo.jpg&#8221; />”;
    }

    I inserted this after an opening php code and before a closing php tag and a closing head tag. Then I uploaded my new header.php file to the FoodiePro directory. Afterwards, I could still access the admin sections of my site, but the front end was blank.

    Site is https://www.theperfectpoach.com (a test site). Thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Bet Hannon

    (@bethannon1)

    Hi David!

    Genesis is a paid framework, so we don’t have access to it to figure out how to help you. Sorry.

    Your best bet is to go to StudioPress for the official support channel, as they will know exactly how to help you. This is part of what you paid for when you bought Foodie Pro.

    Thread Starter DavidB1984

    (@davidb1984)

    Thanks. I figured it out, actually. I took the steps outlined above, only substituting single quotes for the double quotes in the echo, like this:

    if (is_front_page() ) {
    echo ‘<meta property=”og:title” content=”Sentence Spotlight” />
    <meta property=”og:site_name” content=”Sentence Spotlight” />
    <meta property=”og:url” content=”www.sentencespotlight.com” />
    <meta property=”og:description” content=”I pick good sentences and think about why they work.” />
    <meta property=”og:image” content=”https://www.theperfectpoach.com/wp-content/uploads/2015/03/Sentence-Spotlight-Logo.jpg&#8221; />’;
    }

    Moderator Bet Hannon

    (@bethannon1)

    Hi David! Glad you got it worked out!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to add code to head section of homepage’ is closed to new replies.