Jetpack: change og:title value to be all uppercase

Caps Lock

Some blog owners would like their post titles to be displayed in all caps, to attract more clicks on Facebook. Here is how to change Jetpack’s Open Graph meta tags to use an uppercase og:title tag:

/*
 * Plugin Name: Uppercase og:title for Jetpack 
 * Plugin URI: http://wordpress.org/extend/plugins/jetpack/
 * Description: Removes Jetpack's default og:title tag, and replaces it with an uppercase og:title 
 * Author: Jeremy Herve
 * Version: 1.0
 * Author URI: http://jeremy.hu
 * License: GPL2+
 */
function jeherve_capital_title_og( $tags ) {
        global $post;
 
        if ( is_singular() && $post ) {
                unset( $tags['og:title'] );
 
                $tags['og:title'] = strtoupper( get_the_title( $post->ID ) );
        }
        return $tags;
}
add_filter( 'jetpack_open_graph_tags', 'jeherve_capital_title_og' );

To be pasted in your theme’s functions.php file, or in a functionality plugin.