Skip to:
Content
Pages
Categories
Search
Top
Bottom

Proper method to dequeue css

  • I’m looking for the correct method to dequeue bbpress css from the plugin directory and also that of the css folder within the theme.

    The entire site is much larger than just the forum and I really don’t want to call the css for every page as most people don’t have a need to access the forums. I’ll then enqueue the css with is_bbpress combined with is_page(array for the 2 pages that contain shortcodes.

    I need to make sure that it dequeues from both locations as there is a custom css being used.

    Thanks in advance for the help!

Viewing 1 replies (of 1 total)

  • Toby
    Participant

    @tobyhawkins

    I’m using the following in my theme’s functions.php, although for some reason is_bbpress() isn’t working on Buddypress Group Forums for me.

        if( ! function_exists( 'my_dequeue_bbp_scripts' ) )
        {
            function my_dequeue_bbp_scripts()
            {
                if( function_exists( 'is_bbpress' ) )
                {
                    if( ! is_bbpress() )
                    {
                        wp_dequeue_style('bbp-default');
                        wp_dequeue_style('bbp-default-rtl');
                    }
                }
            }
        }
        if( ! is_admin() ) add_action( 'wp_enqueue_scripts', 'my_dequeue_bbp_scripts' );
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar