• Hi! I have a WP Multisite installed. I have a bunch of widgets in the footer of my main site which I’d like to show on my subsites as well. It doesn’t seem like I can grab widget information from other sites without writing a MySQL PHP database grab script.

    Is there a way to present a widget from the main site on other sites of my multisite?

    Thanks!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Not directly. Every site, with the exception of users, uses its own set of DB tables to store data, so mixing of data is not feasible when accessed directly. As you say, grabbing data directly from the DB will allow you to cross over since all the sites are in the same DB, but you cannot use WP functions to directly get data from other sites.

    Note that I keep hedging what I say with “directly”. Indirect access is another story. You can call switch_blog() to cause WP PHP functions to operate as though its for another site. Once you get the data from another site this way, switch back to the proper site. For example, sub-site themes could have a custom footer template whose code switches blog to the main site, calls dynamic_sidebar() which outputs the site’s widgets for the specified widget area. Then switch back so any further code is operating on the correct site again.

    That example is untested. It may be certain WP functions don’t work off of the current blog concept altered with switch_blog(). If they don’t, the switch blog approach will not work. I don’t really know which work and which don’t. Do a quick proof of concept test before dedicating too much time implementing untested ideas.

Viewing 1 replies (of 1 total)

The topic ‘Using Multisite Widgets on Multiple Sites?’ is closed to new replies.