Note: This is not the popular question about how to create multiple instances of a widget. I have a text widget that I am using to display “business hours”. This text needs to go in multiple sidebars and is likely to change often enough to be a nuisance to change it in multiple places. Is there a way to use the same instance of a text widget on more than one sidebar?

Any alternatives that use tokens or some other kind of pointer would also be a solution.

2 Answers
2

A possible solution would be to enable shortcodes in the Text Widget.

add_filter( 'widget_text', 'do_shortcode', 11 );

Then put the same shortcode (i.e.: “[business_hours]“) in all text widgets, and all of them will display the same content.

It’s even possible to add some Conditionals Tags inside the shortcode definition to show different things according to the context where it is being displayed.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *