Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Sharing Dynamic Sidebars across Multisite Blogs WordPress

  • SOLVED

In all sub-sites of my network, I need to display the same sidebar, the sidebar of my main site.
I try this :
global $blog_id;
global $current_blog;
switch_to_blog(1);
dynamic_sidebar($sidebar_name);
restore_current_blog();


but that doesn't work.

Could you write the nice code please ?

Answers (3)

2014-01-10

Ryan S answers:

Unfortunately switch_to_blog() is not the solution, try this instead http://webdevstudios.com/2013/12/17/sharing-sidebars-across-a-multisite-network/

Hope that helps


Sébastien | French WordpressDesigner comments:

That seems a solution. I will look at that tomorrw.
Strange that it's not possible in php, instead of of ajax.


Ryan S comments:

Okay great, yeah unfortunately we do need AJAX to handle some back-end functionality.


Sébastien | French WordpressDesigner comments:


I would pay money to webdevstudios but it's not possible... so...

2014-01-10

Balanean Corneliu answers:

You have tryed this ?
http://wordpress.stackexchange.com/questions/48123/sharing-dynamic-sidebars-across-multisite-blogs


Balanean Corneliu comments:

Seems to be a solution that code let me know if you are testing and if is working.


Sébastien | French WordpressDesigner comments:

Where is the code ?

2014-01-10

Giri answers:

How about this?

global $switched;
switch_to_blog(1);
dynamic_sidebar( 'sidebar-name' );
restore_current_blog();