Support » Plugins and Hacks » Featured Video Plus » [Resolved] Check if function_exists before has_video_post

[Resolved] Check if function_exists before has_video_post

  • Hi, this code works:

    <?php if(has_post_video() ) { ?>
    <?php the_post_video(); ?>
    <?php } else { ?>
    <?php endif; ?>

    but if i disable the plugin or there is an error with it, the whole theme is broken. How can i check if the fuction exists (or if the plugin is active) before check has_post_video?

    Another question, how can i prevent to load the “videojs-css” css from zencdn.net?

    Thanks for your plugin!


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Alex


    I guess function_exists() is exactly what you are looking for:
    if(function_exists('has_post_video') && has_post_video() ) { ?>

    And for your second question look at wp_dequeue_style. Add this to your functions.php:

    add_action( 'admin_enqueue_scripts', 'my_deregister_videojs', 100 );
    add_action( 'wp_enqueue_scripts', 'my_deregister_videojs', 100 );
    function my_deregister_videojs() {
    	wp_dequeue_style( 'videojs' );

    Do you also want to remove the videojs JavaScript? Then just add wp_dequeue_script( ‘videojs’ ); to a new line in the my_deregister_videojs function.

    Hope this does the trick for you? I will add a option to disable videojs in the next version.

    Yes Alex, this tricks is ok, thanks for the support.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Check if function_exists before has_video_post’ is closed to new replies.