• 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 "hreflang" immediately after on homepage only

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 › Add "hreflang" immediately after on homepage only

This topic is: not resolved
  • This topic has 2 replies, 3 voices, and was last updated 8 years ago by Holly Bergfors.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 13, 2015 at 2:15 am #137300
    francky
    Member

    I would like to add hreflang immediately after <head> on homepage only.

    I have the following code but doesn't show immediately after <head>. It just shows somewhere between <head> and </head>.

    add_action( 'genesis_meta', 'int_meta_tag' );
    function int_meta_tag() {
    	if ( is_home() ) {
    		echo '<link rel="alternate" href="http://www.example.com/" hreflang="x-default" />';
    	}
    }

    How can I go through this? I shall appreciate your help.

    January 13, 2015 at 3:13 am #137304
    Brad Dalton
    Participant

    Try the genesis_before hook


    Get Help – Book Consultation.

    January 15, 2015 at 10:03 am #137549
    Holly Bergfors
    Member

    The genesis_meta hook is perfect, you just need to set the priority of the action to "1" and it'll load ahead of everything else between the <head> tags. Just add the "1" at the very end like so:

    add_action( 'genesis_meta', 'int_meta_tag', 1 );


    Need help getting your Genesis site up and running? Check out my portfolio and get in touch!

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ 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