Add Custom Links For Video
Using appropriate Hooks and Filters, you can add custom link buttons for each video. In this tutorial, we will add a View Trailer Button, like this
- First, make sure you are using a child theme, so that changes you made will not disappear when parent theme is updated
- Using one of these two hooks to add custom content to the right metadata area of video.
do_action('videopro-singlevideo-meta-right-before');
do_action('videopro-singlevideo-meta-right-after');
Below is the sample code (add them to childtheme/functions.php file)
/**
* Add Trailer Button for each video
*/
add_action('videopro-singlevideo-meta-right-before', 'videopro_singlevideo_right_meta_trailer_button');
function videopro_singlevideo_right_meta_trailer_button(){
global $post;
$url = get_post_meta($post->ID, 'trailer_link', true);if(isset($url) && $url != ''){
echo '<a href="' . $url . '" target="_blank" class="btn btn-default ct-gradient bt-action metadata-font font-size-1"><span>' . wp_kses(__('<i class="fa fa-caret-square-o-right"></i> View Trailer', 'videopro'),array('i'=>array('class'=>array()))) . '</span></a>';
}
} - Now to add a Trailer Link to a post, add this value to the Custom Fields when editing that post(make sure the Name of the custom field is “trailer_link”)
- DONE. You also can check out this demo http://videopro.cactusthemes.com/v1/methode-technology-hall-intro