Skip to content

Instantly share code, notes, and snippets.

@robertkent
Created October 18, 2013 09:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertkent/7039138 to your computer and use it in GitHub Desktop.
Save robertkent/7039138 to your computer and use it in GitHub Desktop.
Couple of Wordpress functions to change opengraph data used within the Yoast extension.
add_filter('wpseo_locale', 'override_og_locale');
function override_og_locale($locale)
{
return "en_GB"; // thanks to stack overflow for this
}
add_filter('wpseo_opengraph_type', 'homepage_opengraph_type');
function homepage_opengraph_type($type)
{
$page = get_the_ID();
if($page == 2){ // if using specific page/post ID for homepage (might be able to use is_frontpage here?)
return "website";
} else {
return $type;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment