Thread Starter
slice
(@tamarasricehotmailcom)
I probably shouldn’t have done this but I was able to get what I needed by exposing the get_first_thumbnail_url method. I just added the below code at the bottom of vidoe-thumbnails.php.
function get_first_thumbnail_url( $markup ) {
global $video_thumbnails;
return $video_thumbnails->get_first_thumbnail_url( $markup );
}
Then I pull the custom field value myself and just pass the above function the video’s URL.
Thanks for the plug-in. It works great. And if there’s a better way to do the above that doesn’t involve changing the plug-in source please let me know.
The best solution for now (I may add the option for multiple custom fields in the future) is to add some code to your theme’s functions.php file or in your own separate plugin.
If it is the same custom field multiple times, use this:
function custom_video_thumbnail_markup( $markup, $post_id ) {
$fields = get_post_meta( $post_id, 'my_custom_field', false );
foreach ( $fields as $field ) {
$markup .= ' ' . $field;
}
return $markup;
}
add_filter( 'video_thumbnail_markup', 'custom_video_thumbnail_markup', 10, 2 );
Be sure to replace my_custom_field with the name of your custom field.
If the custom fields have different names, use this:
function custom_video_thumbnail_markup( $markup, $post_id ) {
return get_post_meta( $post_id, 'first_custom_field', true ) . ' ' . get_post_meta( $post_id, 'second_custom_field', true );
}
add_filter( 'video_thumbnail_markup', 'custom_video_thumbnail_markup', 10, 2 );
In this case be sure to replace first_custom_field and second_custom_field with the names of your fields.