Conditional check to see if a bootstrap.css is included in a theme

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

Leave a Comment