__( 'Primary Navigation', 'buddypress' ), ) ); // This theme allows users to set a custom background $custom_background_args = array( 'wp-head-callback' => 'bp_dtheme_custom_background_style' ); add_theme_support( 'custom-background', $custom_background_args ); // Add custom header support if allowed if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) ) { define( 'HEADER_TEXTCOLOR', 'FFFFFF' ); // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to bp_dtheme_header_image_width and bp_dtheme_header_image_height to change these values. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'bp_dtheme_header_image_width', 1250 ) ); define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'bp_dtheme_header_image_height', 133 ) ); // 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. // Larger images will be auto-cropped to fit, smaller ones will be ignored. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Add a way for the custom header to be styled in the admin panel that controls custom headers. $custom_header_args = array( 'wp-head-callback' => 'bp_dtheme_header_style', 'admin-head-callback' => 'bp_dtheme_admin_header_style' ); add_theme_support( 'custom-header', $custom_header_args ); } if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { // Register buttons for the relevant component templates // Friends button if ( bp_is_active( 'friends' ) ) add_action( 'bp_member_header_actions', 'bp_add_friend_button', 5 ); // Activity button if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) add_action( 'bp_member_header_actions', 'bp_send_public_message_button', 20 ); // Messages button if ( bp_is_active( 'messages' ) ) add_action( 'bp_member_header_actions', 'bp_send_private_message_button', 20 ); // Group buttons if ( bp_is_active( 'groups' ) ) { add_action( 'bp_group_header_actions', 'bp_group_join_button', 5 ); add_action( 'bp_group_header_actions', 'bp_group_new_topic_button', 20 ); add_action( 'bp_directory_groups_actions', 'bp_group_join_button' ); } // Blog button if ( bp_is_active( 'blogs' ) ) add_action( 'bp_directory_blogs_actions', 'bp_blogs_visit_blog_button' ); } } add_action( 'after_setup_theme', 'bp_dtheme_setup' ); endif; if ( !function_exists( 'bp_dtheme_enqueue_scripts' ) ) : /** * Enqueue theme javascript safely * * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_script * @since BuddyPress (1.5) */ function bp_dtheme_enqueue_scripts() { // Enqueue various scripts wp_enqueue_script( 'bp-jquery-query' ); wp_enqueue_script( 'bp-jquery-cookie' ); // Enqueue scrollTo only on activity pages if ( bp_is_activity_component() ) { wp_enqueue_script( 'bp-jquery-scroll-to' ); } // A similar check is done in BP_Core_Members_Widget, but due to a load order // issue, we do it again here if ( is_active_widget( false, false, 'bp_core_members_widget' ) && ! is_admin() && ! is_network_admin() ) { wp_enqueue_script( 'bp-widget-members' ); } // Enqueue the global JS - Ajax will not work without it wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ), bp_get_version() ); // Add words that we need to use in JS to the end of the page so they can be translated and still used. $params = array( 'my_favs' => __( 'My Favorites', 'buddypress' ), 'accepted' => __( 'Accepted', 'buddypress' ), 'rejected' => __( 'Rejected', 'buddypress' ), 'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ), 'show_x_comments' => __( 'Show all %d comments', 'buddypress' ), 'show_all' => __( 'Show all', 'buddypress' ), 'comments' => __( 'comments', 'buddypress' ), 'close' => __( 'Close', 'buddypress' ), 'view' => __( 'View', 'buddypress' ), 'mark_as_fav' => __( 'Favorite', 'buddypress' ), 'remove_fav' => __( 'Remove Favorite', 'buddypress' ), 'unsaved_changes' => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ), ); wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params ); // Maybe enqueue comment reply JS if ( is_singular() && bp_is_blog_page() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } add_action( 'wp_enqueue_scripts', 'bp_dtheme_enqueue_scripts' ); endif; if ( !function_exists( 'bp_dtheme_enqueue_styles' ) ) : /** * Enqueue theme CSS safely * * For maximum flexibility, BuddyPress Default's stylesheet is enqueued, using wp_enqueue_style(). * If you're building a child theme of bp-default, your stylesheet will also be enqueued, * automatically, as dependent on bp-default's CSS. For this reason, bp-default child themes are * not recommended to include bp-default's stylesheet using @import. * * If you would prefer to use @import, or would like to change the way in which stylesheets are * enqueued, you can override bp_dtheme_enqueue_styles() in your theme's functions.php file. * * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_style * @see http://codex.buddypress.org/releases/1-5-developer-and-designer-information/ * @since BuddyPress (1.5) */ function bp_dtheme_enqueue_styles() { // Register our main stylesheet wp_register_style( 'bp-default-main', get_template_directory_uri() . '/_inc/css/default.css', array(), bp_get_version() ); // If the current theme is a child of bp-default, enqueue its stylesheet if ( is_child_theme() && 'bp-default' == get_template() ) { wp_enqueue_style( get_stylesheet(), get_stylesheet_uri(), array( 'bp-default-main' ), bp_get_version() ); } // Enqueue the main stylesheet wp_enqueue_style( 'bp-default-main' ); // Default CSS RTL if ( is_rtl() ) wp_enqueue_style( 'bp-default-main-rtl', get_template_directory_uri() . '/_inc/css/default-rtl.css', array( 'bp-default-main' ), bp_get_version() ); // Responsive layout if ( current_theme_supports( 'bp-default-responsive' ) ) { wp_enqueue_style( 'bp-default-responsive', get_template_directory_uri() . '/_inc/css/responsive.css', array( 'bp-default-main' ), bp_get_version() ); if ( is_rtl() ) { wp_enqueue_style( 'bp-default-responsive-rtl', get_template_directory_uri() . '/_inc/css/responsive-rtl.css', array( 'bp-default-responsive' ), bp_get_version() ); } } } add_action( 'wp_enqueue_scripts', 'bp_dtheme_enqueue_styles' ); endif; if ( !function_exists( 'bp_dtheme_admin_header_style' ) ) : /** * Styles the header image displayed on the Appearance > Header admin panel. * * Referenced via add_custom_image_header() in bp_dtheme_setup(). * * @since BuddyPress (1.2) */ function bp_dtheme_admin_header_style() { ?> ID ) ) { $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ); // $src, $width, $height if ( !empty( $image ) && $image[1] >= HEADER_IMAGE_WIDTH ) $header_image = $image[0]; else $header_image = get_header_image(); } else { $header_image = get_header_image(); } ?> 'Sidebar', 'id' => 'sidebar-1', 'description' => __( 'The sidebar widget area', 'buddypress' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); // Area 2, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'First Footer Widget Area', 'buddypress' ), 'id' => 'first-footer-widget-area', 'description' => __( 'The first footer widget area', 'buddypress' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 3, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Second Footer Widget Area', 'buddypress' ), 'id' => 'second-footer-widget-area', 'description' => __( 'The second footer widget area', 'buddypress' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 4, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Third Footer Widget Area', 'buddypress' ), 'id' => 'third-footer-widget-area', 'description' => __( 'The third footer widget area', 'buddypress' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); // Area 5, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Fourth Footer Widget Area', 'buddypress' ), 'id' => 'fourth-footer-widget-area', 'description' => __( 'The fourth footer widget area', 'buddypress' ), 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ', ) ); } add_action( 'widgets_init', 'bp_dtheme_widgets_init' ); endif; if ( !function_exists( 'bp_dtheme_blog_comments' ) ) : /** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own bp_dtheme_blog_comments(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @param mixed $comment Comment record from database * @param array $args Arguments from wp_list_comments() call * @param int $depth Comment nesting level * @see wp_list_comments() * @since BuddyPress (1.2) */ function bp_dtheme_blog_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; if ( 'pingback' == $comment->comment_type ) return false; if ( 1 == $depth ) $avatar_size = 50; else $avatar_size = 25; ?>
  • id="comment-">

    %2$s said on %4$s', 'buddypress' ), get_comment_author_url(), get_comment_author(), get_comment_link(), get_comment_date() ); ?>

    comment_approved == '0' ) : ?>
    $depth, 'max_depth' => $args['max_depth'] ) ); ?> comment_ID ) ) : ?> %3$s ', get_edit_comment_link( $comment->comment_ID ), esc_attr__( 'Edit comment', 'buddypress' ), __( 'Edit', 'buddypress' ) ); ?>
    component ) { case 'groups' : case 'friends' : // Only insert avatar if one exists if ( $secondary_avatar = bp_get_activity_secondary_avatar() ) { $reverse_content = strrev( $action ); $position = strpos( $reverse_content, 'a<' ); $action = substr_replace( $action, $secondary_avatar, -$position - 2, 0 ); } break; } return $action; } add_filter( 'bp_get_activity_action_pre_meta', 'bp_dtheme_activity_secondary_avatars', 10, 2 ); endif; if ( !function_exists( 'bp_dtheme_show_notice' ) ) : /** * Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) * * @since BuddyPress (1.2) */ function bp_dtheme_show_notice() { global $pagenow; // Bail if bp-default theme was not just activated if ( empty( $_GET['activated'] ) || ( 'themes.php' != $pagenow ) || !is_admin() ) return; ?>

    custom header image support and sidebar widgets.', 'buddypress' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ); ?>

    0, 'echo' => false, 'exclude' => '', 'title_li' => '' ); $menu = wp_page_menu( $pages_args ); $menu = str_replace( array( '' ), array( '' ), $menu ); echo $menu; do_action( 'bp_nav_items' ); } endif; if ( !function_exists( 'bp_dtheme_page_menu_args' ) ) : /** * Get our wp_nav_menu() fallback, bp_dtheme_main_nav(), to show a home link. * * @param array $args Default values for wp_page_menu() * @see wp_page_menu() * @since BuddyPress (1.5) */ function bp_dtheme_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'bp_dtheme_page_menu_args' ); endif; if ( !function_exists( 'bp_dtheme_comment_form' ) ) : /** * Applies BuddyPress customisations to the post comment form. * * @param array $default_labels The default options for strings, fields etc in the form * @see comment_form() * @since BuddyPress (1.5) */ function bp_dtheme_comment_form( $default_labels ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $fields = array( 'author' => '

    ' . ' ' . '

    ', 'email' => '

    ' . '

    ', 'url' => '

    ' . '

    ', ); $new_labels = array( 'comment_field' => '

    ', 'fields' => apply_filters( 'comment_form_default_fields', $fields ), 'logged_in_as' => '', 'must_log_in' => '

    ' . sprintf( __( 'You must be logged in to post a comment.', 'buddypress' ), wp_login_url( get_permalink() ) ) . '

    ', 'title_reply' => __( 'Leave a reply', 'buddypress' ) ); return apply_filters( 'bp_dtheme_comment_form', array_merge( $default_labels, $new_labels ) ); } add_filter( 'comment_form_defaults', 'bp_dtheme_comment_form', 10 ); endif; if ( !function_exists( 'bp_dtheme_before_comment_form' ) ) : /** * Adds the user's avatar before the comment form box. * * The 'comment_form_top' action is used to insert our HTML within
    * so that the nested comments comment-reply javascript moves the entirety of the comment reply area. * * @see comment_form() * @since BuddyPress (1.5) */ function bp_dtheme_before_comment_form() { ?>
    max_num_pages ) && $wp_query->max_num_pages > 1 ) : ?> element will have the 'no-js' class by default. If you're * using JavaScript for some visual functionality in your theme, and you want to provide noscript * support, apply those styles to body.no-js. * * The no-js class is removed by the JavaScript created in bp_dtheme_remove_nojs_body_class(). * * @package BuddyPress * @since BuddyPress (1.5).1 * @see bp_dtheme_remove_nojs_body_class() */ function bp_dtheme_add_nojs_body_class( $classes ) { $classes[] = 'no-js'; return array_unique( $classes ); } add_filter( 'bp_get_the_body_class', 'bp_dtheme_add_nojs_body_class' ); /** * Dynamically removes the no-js class from the element. * * By default, the no-js class is added to the body (see bp_dtheme_add_no_js_body_class()). The * JavaScript in this function is loaded into the element immediately after the tag * (note that it's hooked to bp_before_header), and uses JavaScript to switch the 'no-js' body class * to 'js'. If your theme has styles that should only apply for JavaScript-enabled users, apply them * to body.js. * * This technique is borrowed from WordPress, wp-admin/admin-header.php. * * @package BuddyPress * @since BuddyPress (1.5).1 * @see bp_dtheme_add_nojs_body_class() */ function bp_dtheme_remove_nojs_body_class() { ?> type ) { $name .= '[]'; } return $name; } add_filter( 'bp_get_the_profile_field_input_name', 'bp_dtheme_add_brackets_to_multiselectbox_attributes' );