Hi. I am using a theme that has disabled the bp_adminbar (which is fine). I tried to add bp_adminbar_notifications_menu to the regular navigation in the header, but the only thing that happens is I get “Notifications 1” displayed. There is no dropdown, just a link to the profile.
This is what I added: “
The function doesn’t have parms. Is there some special styling I have to do to get the dropdown part to work? Perhaps an example somewhere I could look at?
I moved my noticications_menu to somewhere else too. it works fine. If your theme still load adminbar.css, maybe you can take a look at what’s going on in the css.
This is starting to get into the child theme area, which I’m still learning. To import the adminbar.css, is it best to reproduce the inc/css/adminbar.css into the child theme directory? And then import it in the child theme’s stylesheet?
Or, should I do it like ../../plugins/buddypress/bp-themes/bp-default/_inc/css/adminbar.css, which is how the child theme imports the default.css?
Adding bp_adminbar_notifications_menu() in your header will probably work (as long as it’s nested inside of a `
- ` element), but you will need to modify the styles. You can go in one of two directions.
One, you can try to bring over the styles from bp-default/_inc/css/adminbar.css. You can import that entire stylesheet into your child theme with this line at the top of your child theme’s style.css:
`@`import url( ../../plugins/buddypress/bp-themes/bp-default/_inc/css/adminbar.css );
(See https://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/ for more info on BP child themes.) The downside of doing this is that, depending on your theme and the element in which you’re trying to nest the notifications menu, you’re going to have a really hard time getting it to look good with your theme.
The other method is to skip bp_adminbar_notifications_menu() altogether. Instead, copy the entirety of that function from bp-core/bp-core-adminbar.php into functions.php of you child theme. After you’ve copied it, change the name of the copied function (to something like wwday3_adminbar_notifications_menu() – it doesn’t matter, you just have to avoid duplicate function names). Then – and here’s what will make your life easier – change the markup, and in particular the CSS selectors (classes and ids) being produced by the function, so that it matches the CSS selectors in the existing dropdown menus you’re trying to integrate with. Then, in header.php of your child theme (or wherever you’re currently trying to call bp_adminbar_notifications_menu()), make sure to call this new function instead.
Problem is, the current theme doesn’t have dropdowns (that I am aware of). What, in CSS (I’m no expert) would “look” like dropdown markup. I.e. – what should I look for?
There are plugins you can choose from WP repo which will help you with that. Google results
What theme are you using? Is it BuddyLite?
We’ve chatted a bit in the forums there, that’s why I ask.
Not using BuddyLite for this project. It just couldn’t quite get the look I wanted. I do like BuddyLite, however, and may have to find a way to get back to it.
What I’m using is a modified version of the Jooc theme. Unfortunately, Jooc seems to be abandoned by its authors…
This article by @modemlooper should help get you going in the right direction:
Patrick, I’m glad you reminded me about BuddyLite. It does have some pretty cool features. It got me to thinking — maybe if I could play around with the custom CSS enough….
Well, it worked. I got the design I was after, plus the benefit of those really cool dropdown menu functions.
What if you’re trying to tie the custom function into wp_nav_menu_items? Can’t seem to get it working. See my topic about it here:https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/adding-notifications-to-wp_nav_menu_items/
- The topic ‘bp_adminbar_notifications_menu’ is closed to new replies.