function bp_is_blog_page() { global $bp, $is_member_page, $wp_query; if ( $wp_query->is_home && !$bp->is_directory ) return true; if ( !$bp->displayed_user->id && !$bp->is_single_item && !$bp->is_directory && !bp_core_is_root_component( $bp->current_component ) ) return true; return false; }
/** * bp_core_new_nav_item() * * Adds a navigation item to the main navigation array used in BuddyPress themes. * * @package BuddyPress Core * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals() */ function bp_core_new_nav_item( $args = '' ) { global $bp; $defaults = array( 'name' => false, // Display name for the nav item 'slug' => false, // URL slug for the nav item 'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item 'show_for_displayed_user' => true, // When viewing another user does this nav item show up? 'site_admin_only' => false, // Can only site admins see this nav item? 'position' => 99, // Index of where this nav item should be positioned 'screen_function' => false, // The name of the function to run when clicked 'default_subnav_slug' => false // The slug of the default subnav item to select when clicked ); $r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP ); /* If we don't have the required info we need, don't create this subnav item */ if ( empty($name) || empty($slug) ) return false; /* If this is for site admins only and the user is not one, don't create the subnav item */ if ( $site_admin_only && !is_super_admin() ) return false; if ( empty( $item_css_id ) ) $item_css_id = $slug; $bp->bp_nav[$slug] = array( 'name' => $name, 'slug' => $slug, 'link' => $bp->loggedin_user->domain . $slug . '/', 'css_id' => $item_css_id, 'show_for_displayed_user' => $show_for_displayed_user, 'position' => $position ); /*** * If this nav item is hidden for the displayed user, and * the logged in user is not the displayed user * looking at their own profile, don't create the nav item. */ if ( !$show_for_displayed_user && !bp_user_has_access() ) return false; /*** * If we are not viewing a user, and this is a root component, don't attach the * default subnav function so we can display a directory or something else. */ if ( bp_core_is_root_component( $slug ) && !$bp->displayed_user->id ) return; if ( $bp->current_component == $slug && !$bp->current_action ) { if ( !is_object( $screen_function[0] ) ) add_action( 'wp', $screen_function, 3 ); else add_action( 'wp', array( &$screen_function[0], $screen_function[1] ), 3 ); if ( $default_subnav_slug ) $bp->current_action = $default_subnav_slug; } }