#364 closed enhancement (no action required)
Hooks for the Menu on the themes
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Priority: | major | |
| Severity: | Version: | 1.0 | |
| Component: | Keywords: | ||
| Cc: |
Description
I suggest you to add a hook to add menu in the header of bp-home and member-theme
for example:
Al line 72 of /buddypress-theme/member-themes/buddypress-member/header.php
you should add an hook like:
<?php bp_header_menu_extra(); ?>
and add somewhere that
function bp_theme_header_menu_extra() {
do_action('bp_header_menu_extra');
}
function bp_theme_add_menu_item( $link, $title, $condition = true, $class = false, $admin = false, $start_tag = '<li', $finish_tag = '</li>' ) {
if ( $class ) {
$class = ' class="' . $class;
if ( is_page( $condition ) ) { $class = $class . 'selected'; }
$class = $class . '" ';
} elseif ( is_page( $condition ) ) {
$class = ' class="selected" ';
}
if ( $admin && is_admin() ) {
?>
<<?php echo $start_tag; ?><?php if($class) { echo $class } ?>><a href="<?php echo $link; ?>" title="<?php _e( $title, 'buddypress' ) ?>"><?php _( $title, 'buddypress' ) ?></a></<?php echo $finish_tag; ?>>
<?php
}
if ( $condition ) {
?>
<<?php echo $start_tag; ?><?php if($class) { echo $class } ?>><a href="<?php echo $link; ?>" title="<?php _e( $title, 'buddypress' ) ?>"><?php _( $title, 'buddypress' ) ?></a></<?php echo $finish_tag; ?>>
<? }
}
So admin can add menu item:
function my_menus() {
bp_theme_add_menu_item( 'http://buddypressdev.org', 'BuddyPress Developers\' Community' );
}
and add the action
add_action( 'bp_header_menu_extra', 'my_menus' );
?>
Change History (4)
Note: See
TracTickets for help on using
tickets.
Use the hook 'bp_nav_items' for now, this is too much of a chance to introduce before 1.0