WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. RiccardoP
    Member
    Posted 1 year ago #

    Hi, this code works:

    <?php if(has_post_video() ) { ?>
    <?php the_post_video(); ?>
    <?php } else { ?>
    OTHER CODE
    <?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!

    http://wordpress.org/extend/plugins/featured-video-plus/

  2. Alexander Hoereth
    Member
    Plugin Author

    Posted 1 year 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.
    Alex

  3. RiccardoP
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic