Skip to:
Content

BuddyPress.org

Ticket #4098: 4098.2.diff

File 4098.2.diff, 3.2 KB (added by Mamaduka, 12 years ago)
  • bp-themes/bp-default/functions.php

     
    8383        // This theme uses wp_nav_menu() in one location.
    8484        register_nav_menus( array(
    8585                'primary' => __( 'Primary Navigation', 'buddypress' ),
    86         ) );
    87 
     86        ) );   
     87       
     88        $custom_background_args = array(
     89                'wp-head-callback' => 'bp_dtheme_custom_background_style'
     90        );
     91       
    8892        // This theme allows users to set a custom background
    8993        // Backward-compatibility with WP < 3.4 will be removed in a future release
    90         if ( bp_get_major_wp_version() >= 3.4 ) {
    91                 $custom_background_args = array(
    92                         'wp-head-callback' => 'bp_dtheme_custom_background_style'
    93                 );
     94        if ( function_exists( 'get_custom_header' ) ) {
    9495                add_theme_support( 'custom-background', $custom_background_args );
    9596        } else {
    96                 add_custom_background( 'bp_dtheme_custom_background_style' );
     97                add_custom_background( $custom_background_args['wp-head-callback'] );
    9798        }
    9899
    99100        // Add custom header support if allowed
    100101        if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) ) {
    101                 define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
     102                $custom_header_args = array(
     103                        'default-text-color' => 'fff',
     104                        'width' => apply_filters( 'bp_dtheme_header_image_width',  1250 ),
     105                        'height' => apply_filters( 'bp_dtheme_header_image_height', 133  ),
     106                        'wp-head-callback' => 'bp_dtheme_header_style',
     107                        'admin-head-callback' => 'bp_dtheme_admin_header_style'
     108                );
    102109
    103                 // The height and width of your custom header. You can hook into the theme's own filters to change these values.
    104                 // Add a filter to bp_dtheme_header_image_width and bp_dtheme_header_image_height to change these values.
    105                 define( 'HEADER_IMAGE_WIDTH',  apply_filters( 'bp_dtheme_header_image_width',  1250 ) );
    106                 define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'bp_dtheme_header_image_height', 133  ) );
    107 
    108110                // We'll be using post thumbnails for custom header images on posts and pages. We want them to be 1250 pixels wide by 133 pixels tall.
    109111                // Larger images will be auto-cropped to fit, smaller ones will be ignored.
    110                 set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
     112                set_post_thumbnail_size( $custom_header_args['width'], $custom_header_args['height'], true );
    111113
    112114                // Add a way for the custom header to be styled in the admin panel that controls custom headers.
    113115                // Backward-compatibility with WP < 3.4 will be removed in a future release
    114                 if ( bp_get_major_wp_version() >= 3.4 ) {
    115                         $custom_header_args = array(
    116                                 'wp-head-callback' => 'bp_dtheme_header_style',
    117                                 'admin-head-callback' => 'bp_dtheme_admin_header_style'
    118                         );
     116                if ( function_exists( 'get_custom_header' ) ) {                 
    119117                        add_theme_support( 'custom-header', $custom_header_args );
    120118                } else {
    121                         add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
     119                        define( 'HEADER_TEXTCOLOR', $custom_header_args['default-text-color'] );
     120                        define( 'HEADER_IMAGE_WIDTH', $custom_header_args['width'] );
     121                        define( 'HEADER_IMAGE_HEIGHT', $custom_header_args['height'] );
     122                        add_custom_image_header( $custom_header_args['wp-head-callback'], $custom_header_args['admin-head-callback'] );
    122123                }
    123124        }
    124125