Created
October 18, 2013 09:41
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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