I am creating a shortcode plugin for Bootstrap framework that will go along with my theme. However since this would be released to the plugin, if a users’s theme already has Bootstrap.css included, is there a way for me to check this from a plugin?
2 Answers
You might be able to use wp_style_is()
to do this:
$style="bootstrap";
if( ( ! wp_style_is( $style, 'queue' ) ) && ( ! wp_style_is( $style, 'done' ) ) ) {
//queue up your bootstrap
wp_enqueue_style( $style, $path_to_bootstrap, $deps, $ver, $media );
}
This comes with all the same caveats as @Milo’s solution — it’ll only work if the copy of bootstrap.css was registered or enqueued with a handle of bootstrap
.
References
wp_style_is()
wp_enqueue_style()