Featured Video Plus
[resolved] Check if function_exists before has_video_post (3 posts)

  1. RiccardoP
    Posted 3 years ago #

    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!


  2. Alex
    Plugin Author

    Posted 3 years ago #

    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.

  3. RiccardoP
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Featured Video Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic