Support » Plugin: Book Review Library » Include css only on the page of the plugin

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Chris Reynolds

    (@jazzs3quence)

    Not for the front-end CSS, no because I have no way of knowing if you are displaying book reviews on an archive page or using the shortcode on any page or post. If you want to remove the css you can just deregister it:

    wp_deregister_style( 'book-review-library-public' );
    wp_deregister_style( 'book-review-library-genericons' );

    http://codex.wordpress.org/Function_Reference/wp_deregister_style

    How to disable scripts and styles

    i have resolved with

    if ( !('book-review' == get_post_type())  ) {
    	wp_deregister_style( 'book-review-library-public' );
    	wp_deregister_style( 'book-review-library-genericons' );
    }

    with the hook wp_enqueue_scripts

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    If you were using the shortcode, that check would still fail, since the post type would be page or post so the CSS would still load.

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    Scratch that, since you’re deregistering the script on posts and pages (and other post types), if you were using the shortcode, the CSS would not load on those pages. So, again, it’s not something that should be added into the plugin because it could break in certain environments.

    for the shortcode i can use the new function of wordpress has_shortcode.
    With this function it’s possible check if the page/post/ecc contain the shortcode.

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    Good point. I’ll do some testing and see if I can get this to work.

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    Got this working and it will be integrated into the plugin in the next update. Thanks for the feedback!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Include css only on the page of the plugin’ is closed to new replies.