-
-
Save jdevalk/4b998471ce8a5635f964 to your computer and use it in GitHub Desktop.
Takes the Vimeo video ID stored in a custom field and adds a full Vimeo URL to the content to allow the video SEO plugin to index it.
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
<?php | |
/** | |
* Takes the Vimeo video ID stored in a custom field and adds a full Vimeo URL to the content to allow | |
* the video SEO plugin to index it. | |
* | |
* The video URL is added to the top of content to make it override other video's in the post. | |
* | |
* @param string $content the input content field. | |
* @param array $vid the video array for the post. | |
* | |
* @return string $content | |
*/ | |
function fix_content_input( $content, $vid ) { | |
$video_id = get_post_meta( $vid['post_id'], 'id_vimeo', true ); | |
$content = "\n" . 'http://vimeo.com/'. $video_id . "\n" . $content; | |
return $content; | |
} | |
add_filter( 'wpseo_video_index_content', 'fix_content_input', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment