Skip to:
Content

bbPress.org

Changeset 3029


Ignore:
Timestamp:
04/24/2011 04:44:02 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Add theme_compat() function to main $bbp object to load the topic.js and bbpress.css from bbp-twentyten if the currently active theme does not explicitly add theme support for bbPress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbpress.php

    r3026 r3029  
    378378        // Generate rewrite rules
    379379        add_action( 'bbp_generate_rewrite_rules',   array( $this, 'generate_rewrite_rules'   ), 10, 2 );
     380
     381        // Check theme compatability
     382        add_action( 'bbp_setup_theme_compat',       array( $this, 'theme_compat'             ), 10, 2 );
    380383    }
    381384
     
    808811        return $wp_rewrite;
    809812    }
     813
     814    /**
     815     * If not using a bbPress compatable theme, enqueue some basic styling and js
     816     *
     817     * @since bbPress (r3029)
     818     *
     819     * @global bbPress $bbp
     820     * @uses current_theme_supports()
     821     * @uses wp_enqueue_style()
     822     * @uses wp_enqueue_script()
     823     */
     824    function theme_compat() {
     825        global $bbp;
     826
     827        // Check if current theme supports bbPress
     828        if ( !current_theme_supports( 'bbpress' ) ) {
     829
     830            // Load up the default bbPress CSS from bbp-twentyten
     831            wp_enqueue_style ( 'bbpress-style', $bbp->themes_url . '/bbp-twentyten/css/bbpress.css'       );
     832
     833            // Load up the default bbPress JS from bbp-twentyten
     834            wp_enqueue_script( 'bbpress-topic', $bbp->themes_url . '/bbp-twentyten/js/topic.js', 'jquery' );
     835        }
     836    }
    810837}
    811838
Note: See TracChangeset for help on using the changeset viewer.