Tagged: x
-
AuthorPosts
-
May 27, 2016 at 11:01 pm #1013970
twiggleeParticipantHi there!
I have posted in BuddyPress forums but nobody replies so I’m hoping someone here can help.
I would like to delete some of the drop down options the original drop down menu includes for BuddyPress.
Example:
For non-logged in people viewing the site, I’d like to just have the “Log-in” and “Register” options there.
For logged in people, I’d like to add “Log-out” option.
Any help is appreciated. Thanks! 🙂May 28, 2016 at 2:10 am #1014102
Rue NelModeratorHello There,
Thanks for writing in!
To resolve this issue, what you are trying to accomplish requires a template customization, we would like to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Once you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.
function x_buddypress_navbar_menu( $items, $args ) { if ( X_BUDDYPRESS_IS_ACTIVE && x_get_option( 'x_buddypress_header_menu_enable' ) == '1' ) { if ( bp_is_active( 'activity' ) ) { $logged_out_link = bp_get_activity_directory_permalink(); } else if ( bp_is_active( 'groups' ) ) { $logged_out_link = bp_get_groups_directory_permalink(); } else { $logged_out_link = bp_get_members_directory_permalink(); } $top_level_link = ( is_user_logged_in() ) ? bp_loggedin_user_domain() : $logged_out_link; $submenu_items = ''; if ( ! is_user_logged_in() ) { if ( bp_get_signup_allowed() ) { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_signup_page() . '" class="cf"><i class="x-icon-pencil" data-x-icon="" aria-hidden="true"></i> <span>' . x_get_option( 'x_buddypress_register_title' ) . '</span></a></li>'; $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activation_page() . '" class="cf"><i class="x-icon-key" data-x-icon="" aria-hidden="true"></i> <span>' . x_get_option( 'x_buddypress_activate_title' ) . '</span></a></li>'; } $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . wp_login_url() . '" class="cf"><i class="x-icon-sign-in" data-x-icon="" aria-hidden="true"></i> <span>' . __( 'Log in', '__x__' ) . '</span></a></li>'; } else { if ( bp_is_active( 'activity' ) ) { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activity_directory_permalink() . '" class="cf"><i class="x-icon-thumbs-up" data-x-icon="" aria-hidden="true"></i> <span>' . x_get_option( 'x_buddypress_activity_title' ) . '</span></a></li>'; } if ( bp_is_active( 'groups' ) ) { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_groups_directory_permalink() . '" class="cf"><i class="x-icon-sitemap" data-x-icon="" aria-hidden="true"></i> <span>' . x_get_option( 'x_buddypress_groups_title' ) . '</span></a></li>'; } if ( is_multisite() && bp_is_active( 'blogs' ) ) { $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_blogs_directory_permalink() . '" class="cf"><i class="x-icon-file" data-x-icon="" aria-hidden="true"></i> <span>' . x_get_option( 'x_buddypress_blogs_title' ) . '</span></a></li>'; } $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_members_directory_permalink() . '" class="cf"><i class="x-icon-male" data-x-icon="" aria-hidden="true"></i> <span>' . x_get_option( 'x_buddypress_members_title' ) . '</span></a></li>'; $submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . wp_logout_url() . '" class="cf"><i class="x-icon-sign-out" data-x-icon="" aria-hidden="true"></i> <span>' . __( 'Logout', '__x__' ) . '</span></a></li>'; } if ( $args->theme_location == 'primary' ) { $items .= '<li class="menu-item current-menu-parent menu-item-has-children x-menu-item x-menu-item-buddypress">' . '<a href="' . $top_level_link . '" class="x-btn-navbar-buddypress">' . '<span><i class="x-icon-user" data-x-icon="" aria-hidden="true"></i><span class="x-hidden-desktop"> ' . __( 'Social', '__x__' ) . '</span></span>' . '</a>' . '<ul class="sub-menu">' . $submenu_items . '</ul>' . '</li>'; } } return $items; } add_filter( 'wp_nav_menu_items', 'x_buddypress_navbar_menu', 9997, 2 );Please copy the raw code here (http://pastebin.com/pB4iesbQ) to preserve the unicode html entities or the data-x-icon value.
Please let us know if this works out for you.
May 28, 2016 at 6:56 am #1014293
twiggleeParticipantThis reply has been marked as private.May 28, 2016 at 7:42 am #1014321
ChristopherModeratorHi there,
Please connect to FTP account, navigate to wp-content/themes/x-child and insert the code in functions.php file.
Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.Thanks.
May 28, 2016 at 7:48 am #1014325
twiggleeParticipantHi!
Sorry for not clarifying. I’m still setting up child theme and uncertain to what to put in “Theme URI” part. (Ive never made a child theme before)
” Theme URI: http://example.com/twenty-fifteen-child/ ”
Is it something similar to ” http://theme.co/x/demo/icon/3/ ” ?
ThanksMay 28, 2016 at 8:42 am #1014359
ChristopherModeratorHi there,
I’m still unsure what you’re referring to. Are you referring to the comment part at the beginning of style.css file ?
/* Theme Name: X – Child Theme Theme URI: http://theme.co/x/ Author: Themeco Author URI: http://theme.co/ Description: Make all of your modifications to X in this child theme. Version: 1.0.0 Template: x */No need to change anything, it’s comment and has no affect on your site. Please follow this link to setup a child theme https://theme.co/x/member/kb/how-to-setup-child-themes/
Thanks.
May 28, 2016 at 9:05 am #1014379
twiggleeParticipantThanks that was a lot easier. I was trying to manually install it before.
I think I got it working.
Last thing is, how can I add to the above code and disable the “activate” drop down option as well?
Thanks! 🙂May 28, 2016 at 4:57 pm #1014648
RadModeratorHi there,
You can just append the code to your child theme’s functions.php by either File manager’s editor, or by text editor through FTP.
And from the code provided, you can remove this line to remove “activate” item.
$submenu_items .= '<li class="menu-item menu-item-buddypress-navigation"><a href="' . bp_get_activation_page() . '" class="cf"><i class="x-icon-key" data-x-icon="" aria-hidden="true"></i> <span>' . x_get_option( 'x_buddypress_activate_title' ) . '</span></a></li>';Thanks!
May 28, 2016 at 11:22 pm #1014902
twiggleeParticipantThank you! 🙂
May 29, 2016 at 12:36 am #1014945
Rue NelModeratorYou are most welcome!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1013970 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
