Skip to:
Content

bbPress.org

Changeset 3959


Ignore:
Timestamp:
06/14/2012 12:43:22 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Theme Compatilibilty:

  • Add theme hierachy check for default bbPress styling.
  • Use file_exists() checks in child & parent themes before enqueuing from theme compatibility.
  • Fixes #1849.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-theme-compat/bbpress-functions.php

    r3928 r3959  
    5252    /**
    5353     * Component global variables
    54      * 
     54     *
    5555     * Note that this function is currently commented out in the constructor.
    5656     * It will only be used if you copy this file into your current theme and
    5757     * uncomment the line above.
    58      * 
     58     *
    5959     * You'll want to customize the values in here, so they match whatever your
    6060     * needs are.
     
    140140     */
    141141    public function enqueue_styles() {
     142
     143        // LTR or RTL
    142144        $file = is_rtl() ? 'css/bbpress-rtl.css' : 'css/bbpress.css';
    143         wp_enqueue_style( 'bbp-default-bbpress', $this->url . $file, array(), $this->version, 'screen' );
     145
     146        // Check child theme
     147        if ( file_exists( get_stylesheet_directory() . $file ) ) {
     148            $location = trailingslashit( get_stylesheet_directory_uri() );
     149            $handle   = 'bbp-child-bbpress';
     150
     151        // Check parent theme
     152        } elseif ( file_exists( get_template_directory() . $file ) ) {
     153            $location = trailingslashit( get_template_directory_uri() );
     154            $handle   = 'bbp-parent-bbpress';
     155
     156        // bbPress Theme Compatibilty
     157        } else {
     158            $location = trailingslashit( $this->url );
     159            $handle   = 'bbp-default-bbpress';
     160        }
     161
     162        // Enqueue the bbPress styling
     163        wp_enqueue_style( $handle, $location . $file, array(), $this->version, 'screen' );
    144164    }
    145165
     
    177197            /* <![CDATA[ */
    178198            var ajaxurl = '<?php echo admin_url( 'admin-ajax.php' ); ?>';
    179            
     199
    180200            <?php if ( bbp_is_single_user_edit() ) : ?>
    181201            if ( window.location.hash == '#password' ) {
Note: See TracChangeset for help on using the changeset viewer.