Skip to:
Content
Pages
Categories
Search
Top
Bottom

Enque bbpress scripts only on forum pages


  • Themezly
    Participant

    @themezly

    I am working on a theme and need to deque all bbpress scripts and enque my own if I am on forum pages. This is what I used to start with

    	if( !is_admin() ){ 
    		/**
    		 *	Replace bbpress style with our own
    		 *  @internal
    		 */
    		function _thz_action_bbpress_style() {
    			
    			wp_dequeue_style( 'bbp-default' );
    			
    			if (is_bbpress()){
    				
    				wp_enqueue_style( THEME_NAME. '-bbpress' );	
    		
    			}
    			
    	
    		}
    		
    		if (function_exists('is_bbpress')){
    			add_action( 'wp_enqueue_scripts', '_thz_action_bbpress_style' );
    		}
    		
    		
    	
    	}

    issue with this is that is_bbpress() is not recognized on pages that use any bbpress shortcodes like

    [bbp-forum-index]

    Can someone please provide a working conditional that runs only on forum pages and not throughout the whole site. Thnx!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar