bp_dtheme_setup

Sets up theme defaults and registers support for various WordPress and BuddyPress features.

Description

bp_dtheme_setup(); 

Note that this function is hooked into the after_setup_theme hook, which runs before the init hook. The init hook is too late for some features, such as indicating support post thumbnails.

To override bp_dtheme_setup() in a child theme, add your own bp_dtheme_setup to your child theme's functions.php file.


Usage

  1. if ( !function_exists( 'bp_dtheme_setup' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-themes/bp-default/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_dtheme_setup(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-themes/bp-default/functions.php  
  1. function bp_dtheme_setup() { 
  2.  
  3. // Load the AJAX functions for the theme 
  4. require( get_template_directory() . '/_inc/ajax.php' ); 
  5.  
  6. // This theme styles the visual editor with editor-style.css to match the theme style. 
  7. add_editor_style(); 
  8.  
  9. // This theme comes with all the BuddyPress goodies 
  10. add_theme_support( buddypress ); 
  11.  
  12. // This theme uses post thumbnails 
  13. add_theme_support( 'post-thumbnails' ); 
  14.  
  15. // Add default posts and comments RSS feed links to head 
  16. add_theme_support( 'automatic-feed-links' ); 
  17.  
  18. // Add responsive layout support to bp-default without forcing child 
  19. // themes to inherit it if they don't want to 
  20. add_theme_support( 'bp-default-responsive' ); 
  21.  
  22. // This theme uses wp_nav_menu() in one location. 
  23. register_nav_menus( array( 
  24. 'primary' => __( 'Primary Navigation', buddypress ),  
  25. ) ); 
  26.  
  27. // This theme allows users to set a custom background 
  28. $custom_background_args = array( 
  29. 'wp-head-callback' => 'bp_dtheme_custom_background_style
  30. ); 
  31. add_theme_support( 'custom-background', $custom_background_args ); 
  32.  
  33. // Add custom header support if allowed 
  34. if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) ) { 
  35. define( 'HEADER_TEXTCOLOR', 'FFFFFF' ); 
  36.  
  37. // The height and width of your custom header. You can hook into the theme's own filters to change these values. 
  38. // Add a filter to bp_dtheme_header_image_width and bp_dtheme_header_image_height to change these values. 
  39.  
  40. // 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. 
  41. // Larger images will be auto-cropped to fit, smaller ones will be ignored. 
  42. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); 
  43.  
  44. // Add a way for the custom header to be styled in the admin panel that controls custom headers. 
  45. $custom_header_args = array( 
  46. 'wp-head-callback' => 'bp_dtheme_header_style',  
  47. 'admin-head-callback' => 'bp_dtheme_admin_header_style
  48. ); 
  49. add_theme_support( 'custom-header', $custom_header_args ); 
  50.  
  51. if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { 
  52. // Register buttons for the relevant component templates 
  53. // Friends button 
  54. if ( bp_is_active( 'friends' ) ) 
  55.  
  56. // Activity button 
  57. if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) 
  58.  
  59. // Messages button 
  60. if ( bp_is_active( 'messages' ) ) 
  61.  
  62. // Group buttons 
  63. if ( bp_is_active( 'groups' ) ) { 
  64.  
  65. // Blog button 
  66. if ( bp_is_active( 'blogs' ) )