#15404 closed defect (bug) (wontfix)
Allow to target the different list items via CSS in the Admin Bar
Reported by: | defries | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
For the My Site menu in the Admin Bar there's no way currently to remove certain list items of the specific site.
If you have more than 20 sites in the dropdown you would have to manually look up 20 css classes to target the list items. For instance, if you don't want your visitor to directly go to the Dashboard you would need 20 css statements set to display:none.
Via a simple CSS change one would be able to target a specific list item via a display:none statement.
Attachments (3)
Change History (17)
#1
follow-up:
↓ 2
@
14 years ago
- Component changed from Accessibility to Administration
- Milestone changed from Awaiting Review to 3.1
#2
in reply to:
↑ 1
@
14 years ago
Replying to nacin:
The CSS change looks fine, that said, there are remove_node and remove_menu methods for the WP_Admin_Bar class, that ideally you would then leverage to remove specific ones.
Obviously you also will want to make sure that you are actually denying users access to these pages via capability checks, unless of course this is only about usability and simplicity, versus access.
It's more about usability and simplicity. Just to have some easy control over what is shown in that particular menu.
#3
follow-up:
↓ 6
@
14 years ago
- Keywords needs-patch added; admin bar removed
Looking at the code some more, the add_menu() method wants an 'id' to be a sanitized value. We shouldn't overload it.
That's fine, because add_menu also takes a 'meta' argument, which can take the form of array( 'class' => 'more classes here' )
.
#4
follow-up:
↓ 5
@
14 years ago
Those additional classes should probably be namespaced the way the ids are. I'd suggest ab-blog-
, i.e. ab-blog-dashboard.
#5
in reply to:
↑ 4
@
14 years ago
Replying to nacin:
Those additional classes should probably be namespaced the way the ids are. I'd suggest
ab-blog-
, i.e. ab-blog-dashboard.
With the dash con-catting it to one class there's no way to target them. Or am I missing the point?
#6
in reply to:
↑ 3
@
14 years ago
Replying to nacin:
That's fine, because add_menu also takes a 'meta' argument, which can take the form of
array( 'class' => 'more classes here' )
.
I see that now too, no clue how to do that, but I understand what you mean.
Basically I was looking for an easy CSS hack to change for instance a list item to display:none, but also to change a background and/or color and such.
#10
@
14 years ago
- Keywords needs-refresh added; needs-testing removed
These patches no longer apply cleanly because the surrounding code has changed.
#11
@
14 years ago
- Keywords needs-refresh removed
I have nacin's updated. It's a good idea but we shouldn't change the ID because then we have duplicate IDs which wouldn't be valid.
#12
@
14 years ago
Devil's advocate: What's the use case here? Instead of display:none, why not loop through and individually remove those nodes in PHP?
The CSS change looks fine, that said, there are remove_node and remove_menu methods for the WP_Admin_Bar class, that ideally you would then leverage to remove specific ones.
Obviously you also will want to make sure that you are actually denying users access to these pages via capability checks, unless of course this is only about usability and simplicity, versus access.