Skip to:
Content

BuddyPress.org

Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#363 closed defect (bug) (duplicate)

Hooks for the Menu on the themes

Reported by: nicolagreco's profile nicolagreco Owned by: nicolagreco's profile nicolagreco
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 (2)

#1 @apeatling
16 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

#2 @(none)
15 years ago

  • Milestone Future Enhancements deleted

Milestone Future Enhancements deleted

Note: See TracTickets for help on using tickets.