Viewing 1 replies (of 1 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    When you share a post on Facebook, or when Jetpack Publicize publishes a post to your Facebook page, Facebook crawls the page and looks for Open Graph meta tags in the head to build a complete post preview (with an image, title, description, or video preview).

    You can see what Facebook sees by entering one of your posts’ URLs in Facebook Debugger:
    https://developers.facebook.com/tools/debug

    Jetpack automatically adds Open Graph meta tags for you, but we do not add any Video Meta tag that would allow Facebook to recognize the videos in your posts. You could use another plugin to handle that, or add the Video tag yourself via a Custom Field, for example.

    Here is a code you could add to your theme’s functions.php file to add a video tag if you have specified a video_url custom field:

    function jeherve_video_graph() {
    	global $post;
    
    	$fb_video_url = get_post_meta($post->ID, 'video_url', true);
    	$fb_graph_ouput = sprintf( '
    		<meta property="og:video:type" content="application/x-shockwave-flash">
    		<meta property="og:video:width" content="1280">
    		<meta property="og:video:height" content="720">
    		<meta property="og:video" content="%s" />
    	', esc_attr( $fb_video_url ) );
    
    	if (!false == $fb_video_url)
    		echo $fb_graph_ouput;
    }
    add_action( 'wp_head', 'jeherve_video_graph' );

    You can read more about the tags needed by Facebook here:
    https://stackoverflow.com/questions/3847496/open-graph-ogvideo-meta-tags-content

Viewing 1 replies (of 1 total)
  • The topic ‘Posting Videos to Facebook’ is closed to new replies.