For that, you can install this plugin: https://ww.wp.xz.cn/plugins/administrative-shortcodes/, and then use the [switch_to_blog] shortcode to run the widget shortcode in the context of another website on your network. For example:
[switch_to_blog id="1"]
[widget id="text-1"]
[/switch_to_blog]
So now that will display the “text-1” widget from the sub-site with the ID of 1 instead of the current website.
Thread Starter
wph4
(@wph4)
Thanks,
id from the site I take from the network list of sites.
How do I know id from widget?
Cheers
Thread Starter
wph4
(@wph4)
Hi,
using inspect from chrome I saw the widget id. but it is still not working.
can you help me?
http://marketplace.scrapplezier.nl/handmade/
Thanks
So I tried to do that myself and it didn’t work, dug around and found that while using switch_to_blog, WP does not reset some of its global variables that is used to render widgets (see: https://wordpress.stackexchange.com/a/48227/85390) so unfortunately it’s not possible to share widgets across a network.
Might I ask what you’re looking to achieve with this? Perhaps I could suggest an alternative way to get that result.
Thread Starter
wph4
(@wph4)
Thanks for coming by.
The point is: I have a main site with some info that is put in a text widget. A picture from a last ebook with a link to that.
It is done by the main site.
Subsites are “dochters” from the main site, which share the same edition to their visitors.
So whenever a new edition comes to the main site, I want to have this info also updated by the subsites, automatically.
Users are all non tech and volunteers, so I am trying to make it the easier way for them.
Cheers
PS: In the mean time I am also trying/searching for some other alternatives.
I see. In such case I would recommend to store those “global content pieces” as “post”s, then display that post on the subsites with the help of a shortcode. Unlike widgets, posts can be displayed from another website in the network.
I looked around and found this: https://ww.wp.xz.cn/plugins/post-content-shortcodes/, which has built-in MU support as well.
Thread Starter
wph4
(@wph4)
Thanks a lot. I will have a look.