Changeset 2038
- Timestamp:
- 11/04/2015 10:01:23 PM (9 years ago)
- Location:
- sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2
- Files:
-
- 1 deleted
- 1 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/functions.php
r1899 r2038 14 14 require_once get_template_directory() . '/plugins/wordpresstv-anon-upload/anon-upload.php'; 15 15 require_once get_template_directory() . '/plugins/wordpresstv-upload-subtitles/wordpresstv-upload-subtitles.php'; 16 require_once get_template_directory() . '/plugins/wordpresstv- twitter-cards/wordpresstv-twitter-cards.php';16 require_once get_template_directory() . '/plugins/wordpresstv-open-graph/wordpresstv-open-graph.php'; 17 17 18 18 add_action( 'after_setup_theme', array( $this, 'setup' ) ); -
sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-open-graph/wordpresstv-open-graph.php
r2037 r2038 1 1 <?php 2 2 3 namespace WordPressTV\ TwitterCards;3 namespace WordPressTV\OpenGraph; 4 4 5 5 /* 6 6 * Register hook callbacks 7 7 */ 8 add_filter( 'jetpack_open_graph_tags', __NAMESPACE__ . '\ add_player_tags', 11 ); // after wpcom_twitter_cards_tags8 add_filter( 'jetpack_open_graph_tags', __NAMESPACE__ . '\customize_open_graph_tags', 11 ); // after wpcom_twitter_cards_tags 9 9 10 10 /** 11 * Add tags that are necessary for videos to be embedded into tweets11 * Customize each post's Open Graph tags for WPTV 12 12 */ 13 function add_player_tags( $og_tags ) {13 function customize_open_graph_tags( $og_tags ) { 14 14 global $post; 15 15 … … 25 25 } 26 26 27 // Add the tags necessary for the player27 // Make WPTV videos embeddable in Twitter player cards 28 28 $video_info = video_get_info_by_guid( $video_id[0] ); 29 29 list( $width, $height ) = wp_expand_dimensions( $video_info->width, $video_info->height, 560, 315 ); 30 $mp4_url = set_url_scheme( wp_get_attachment_url( $video_info->post_id ), 'https' ); 30 31 31 32 $og_tags['twitter:card'] = 'player'; … … 33 34 $og_tags['twitter:player:width'] = $width; 34 35 $og_tags['twitter:player:height'] = $height; 35 $og_tags['twitter:player:stream'] = wp_get_attachment_url( $video_info->post_id );36 $og_tags['twitter:player:stream'] = $mp4_url; 36 37 $og_tags['twitter:player:stream:content_type'] = 'video/mp4'; 38 39 /* 40 * Embed MP4 videos in Facebook posts instead of the Flash player 41 * 42 * @todo: This can be removed once https://github.com/Automattic/jetpack/issues/2950 is fixed 43 */ 44 $og_tags['og:video:type'] = 'video/mp4'; 45 $og_tags['og:video'] = $mp4_url; 46 $og_tags['og:video:secure_url'] = $mp4_url; 37 47 38 48 return $og_tags;
Note: See TracChangeset
for help on using the changeset viewer.