Theme Hooks
True Mag provides some “hooks” that allow developers to customize the theme (using child-theme or plugin)
| No. | Name | Purpose | Since | Sample Code |
| 1 | cactus_player_hook | To replace the video player by your own player | 3.2 | In this case, you want to use JWPlayer instead of default video player (True Mag had automatically recognized JWPlayer)
function jwplayer_hook($player_html, $url, $id_post) {
$file = get_post_meta($id_post, 'tm_video_file', true);
if($file!=''){
if(class_exists('JWP6_Plugin')) {
if (JWP6_USE_CUSTOM_SHORTCODE_FILTER)
add_filter('tm_video_filter', array('JWP6_Shortcode', 'widget_text_filter'));
}
if(function_exists('jwplayer_tag_callback')) {
add_filter('tm_video_filter', 'jwplayer_tag_callback');
}
$jwplayer_shortcode = '[jwplayer config="firstplayer" file="'.$file.'" ]';
echo apply_filters('tm_video_filter', $jwplayer_shortcode);
}else{
return $player_html;
}
}
add_filter( 'cactus_player_hook', 'jwplayer_hook',10,3 );
|