#34942 closed enhancement (duplicate)
Add a filter for $index in dynamic_sidebar() function
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.6 |
| Component: | Widgets | Keywords: | has-patch |
| Focuses: | Cc: |
Description
It would be nice if plugins can filter the index (the name of the widget area) in dynamic_sidebar() function.
While there are a lot of hooks inside this function, it is not possible to switch an area to another.
A lot of plugins try to offer WordPress users the ability to create and switch areas dynamically, but all of them (,which I found) has to offer a custom template tag to render the desired widget area. Users need to edit their files like sidebar.php.
Attachments (2)
Change History (9)
#2
@
10 years ago
Wondering if it will be a bit more useful if the filter is after $sidebars_widgets = wp_get_sidebars_widgets(); and then pass $sidebars_widgets as argument to it.
@
10 years ago
Includes the set of widget areas with allocated widgets as an argument. Implement @azaozz 's comment.
#3
follow-up:
↓ 4
@
10 years ago
@azaozz Do we still need the other 2 arguments, $wp_registered_sidebars and $wp_registered_widgets when we have the $sidebars_widgets, which is a combination of the 2?
#4
in reply to:
↑ 3
@
10 years ago
Replying to ShinichiN:
@azaozz Do we still need the other 2 arguments,
$wp_registered_sidebarsand$wp_registered_widgetswhen we have the$sidebars_widgets, which is a combination of the 2?
Yes, we still need the other two. $wp_registered_sidebars and $wp_registered_widgets are stored in memory and $sidebars_widgets is derived from the database. Fun times.
Adds a filter "dynamic_sidebar_index"