-
Hi.
WP asset dependency system is primarily meant for determining the order of which the asset should be loaded in.
In FV Player Pro,
wp_enqueue_style()
is used as a conditional loading mechanism, and the well known developer help plugin Query Monitor correctly highlights this as a red error.wp_enqueue_style( ‘fv-player-pro’, plugins_url( ‘/css/style.css’, __FILE__ ), array(‘fv_flowplayer’), $this->version );
Your core player plugin actually goes through a list of condition checks before it enqueues
fv_flowplayer
, most importantly “does this page even have a matching shortcode/video”. Pro plugin does not have similar checks and just tries to loadfv-player-pro
stylesheet on every request, which developer help tools flag as an error.As a developer, I’d like to keep the dependency error check in place to catch other errors, and not disable it just because we’re using FV Player.
Fixing this is fortunately simple:
* move your Pro player enqueue to priority 11, so core plugin can have its own stylesheet enqueued
add_action( ‘wp_enqueue_scripts’, array( $this, ‘styles’ ), 11 );
* Pro player
styles()
function can usewp_style_is()
to check loading conditions…
} else {
if ( wp_style_is( ‘fv_flowplayer’ ) ) {
wp_enqueue_style( ‘fv-player-pro’, plugins_url( ‘/css/style.css’, __FILE__ ), array(‘fv_flowplayer’), $this->version );
}
}
…This correctly loads
fv-player-pro
stylesheet whereverfv_flowplayer
is loaded, and avoids trying otherwise.Thanks, bye