Created
March 18, 2014 15:22
-
-
Save joeyblake/9622208 to your computer and use it in GitHub Desktop.
Customizing SharePress og:meta tags with custom fields
This file contains 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 this to your theme's functions.php file | |
//Modify the function to add the custom field value you are looking for | |
add_filter('sharepress_og_tags', 'my_sharepress_og_tags'); | |
function my_sharepress_og_tags( $og ) { | |
global $post; | |
$custom_value = get_post_meta($post->ID, 'your custom field name', true); | |
$og = array_merge($og, array( | |
'og:title' => $og['og:title'] . " " . $custom_value | |
)); | |
return $og; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment