Skip to content

Instantly share code, notes, and snippets.

@joeyblake
Created March 18, 2014 15:22
Show Gist options
  • Save joeyblake/9622208 to your computer and use it in GitHub Desktop.
Save joeyblake/9622208 to your computer and use it in GitHub Desktop.
Customizing SharePress og:meta tags with custom fields
//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