lonelydime (@lonelydime)

Forum Replies Created

Viewing 1 replies (of 1 total)
  • @lonelydime

    Participant

    It’s been about 10 years since I’ve attempted anything WordPress or PHP for that matter, but while this works it feels like it’s going to break in an update.

    add_filter( 'bbp_default_styles', 'rew_dequeue_bbpress_css' );
    
    function rew_dequeue_bbpress_css ($defaults ){
    	fixed_bbp_enqueue_style("bbp-default", "css/bbpress.css", array(), bbp_get_version());
    	unset ($defaults['bbp-default']) ;
    	return $defaults ;
    }
    
    function fixed_bbp_enqueue_style( $handle = '', $file = '', $deps = array(), $ver = false, $media = 'all' ) {
            // Attempt to locate an enqueueable
            $located = bbp_locate_enqueueable( $file );
    	$located = str_replace('/bitnami/wordpress', '', $located);
    		
            // Enqueue if located
            if ( ! empty( $located ) ) {
    
                    // Make sure there is always a version
                    if ( empty( $ver ) ) {
                            $ver = bbp_get_version();
                    }
    
                    // Make path to file relative to site URL
                    $located = bbp_urlize_enqueueable( $located );
    
                    // Register the style
                    wp_register_style( $handle, $located, $deps, $ver, $media );
    
                    // Enqueue the style
                    wp_enqueue_style( $handle );
            }
    
            return $located;
    }

    From what I can tell your snippet does, it just clears out the default css object so the loop to bbp_enqueue_style skips including it and then I can inject my own function. The scripts function seem more complicated because there are many more includes than one file and they’re based on pages from what I can tell. Is what I’ve done what you were referring to?

Viewing 1 replies (of 1 total)