May 12, 2012

Filters In Youtube Favorite Video Posts

Today’s update of Youtube Favorite Video Posts includes a couple filters that can be used to modify the post title and content whenever new items are saved. Here are a few snippets that show the filters in action. These can be added to your theme’s functions.php file, or, as is often applicable, to the child theme you have created from your primary theme of choice.

<?php
/* A brief overview of filters that are now available in Youtube Favorite Video Posts.
*
* These allow easy overriding of the default post title and content before the
* new post is created.
*/

add_filter( 'yfvp_new_video_embed_code', 'myprefix_change_yfvp_post_content', 10, 1 );
/* Adds a little nonsense introduction to the video before embedding the
* iframe that was provided by default */
function myprefix_change_yfvp_post_content( $video_embed_code, $video_token ) {

$new_content = 'My video post includes the token - ' . $video_token . ' - before embedding!';
$new_content .= $video_embed_code;

return $new_content;
}

add_filter( 'yfvp_new_video_item_title' 'myprefix_change_yfvp_post_title', 10, 1 );
/* Changes the default title from Youtube */
function myprefix_change_yfvp_post_title( $current_title ) {
return 'This is a video: ' . $current_title;
}
view raw gistfile1.aw This Gist brought to you by GitHub.

Youtube Favorite Video Posts can be downloaded through the WordPress plugin repository. More info can be found through the overall project status page.

Exploring Intention When Registering Custom Post Types In WordPress

May 7, 2012

Filters In Automatic Featured Image Posts

April 14, 2012

WordPress Is Not Caching Your Custom Feed

March 17, 2012

Where To?

January 21, 2012

Snow On The Ground In Portland

January 18, 2012

Full Archives

2004-2011

 

Latest Updates:


January 24th
11:00 pm

GPS, Smartphones, and the Dumbing Down of Personal Navigation – Technology – The Atlantic Cities

Exactly – “Whatever happened to being able to look around you and use your eyes and ears (not to mention your nose) to determine whether you were somewhere safe or not?”


December 7th
10:56 pm

May 14th
2:27 am

Jack Makes (real) Irish Soda Bread