I’m wondering if it is possible to add a specific text-widget($id) or either an entire dynamic_sidebar($id) in to the wordpress’ dashboard.
Actually, I just need the client to edit the text of a text-widget on dashboard, without going to the menu “Appearance > Widgets” â this section is hidden for this user role.
If you can leave here some link or code, I’d appreciate it.
Thanks in advance
To solve this, my research led me to:
control_callback
when creating a widget via functions.php or plugin?The following is just a proof of concept based on the always excellent code of @Bainternet (in the Q about
control_callback
).The Dashboard Widget displays the title of a selected Text Widget it displays “Content of…” but should be “Title of…”
Its configuration screen displays a dropdown with all Text Widgets of all Sidebars:
Here’s the Appearance > Widgets screen
Now, what’s left to implement is an editing interface (text input and so on) and save the proper values inside the option
widget_text
, using:update_option('widget_text', $a_VERY_well_structured_array_otherwise_things_will_break);
.