Skip to content

Instantly share code, notes, and snippets.

@anneallen
Last active September 1, 2016 23:26
Show Gist options
  • Save anneallen/5952578 to your computer and use it in GitHub Desktop.
Save anneallen/5952578 to your computer and use it in GitHub Desktop.
Add Open Graph HTML and header tags to Genesis Theme
/**Adding the Open Graph in the Language Attributes*/
add_filter('language_attributes', 'child_add_opengraph_doctype');
function child_add_opengraph_doctype( $output ) {
return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';
}
/** Add Open Graph meta tag to head*/
add_action( 'genesis_meta', 'custom_child_open_graph_meta_tag' );
function custom_child_open_graph_meta_tag() {
echo '
<meta property="og:title" content="XXXX"/>
<meta property="og:url" content="http://www.XXXX.com/"/>
<meta property="og:image" content="http://www.XXX.com/wp-content/themes/xxxxlogo.png"/>
<meta property="og:description" content="loreum Ipsum etc etc"/>
';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment