2

I'm using WordPress multisite and need to display content across all subsites in the sidebar. This is a network of 50+ sites so updating all 50+ sidebars with this content every few days is not practical.

One solution I've found is to simply insert the content I want into sidebar.php in the theme editor, though I don't want my client editing this file, and want them to use TinyMCE editor instead of HTML.

Another idea was to embed an iframe into each subsite and have my client update the page that the iframe was referencing.

And the final idea I had was to create a plugin with the TinyMCE editor that would inject code into the sidebar.php file when saved, though I don't know if access to editing theme files is available to plugins.

Is there a better solution that I'm not thinking of? I tried a few plugins with no success, did I miss one?

  • I figured out a solution (but let me know if there is a better one). I created a page template specific to this multisite wide content then used an iframe in the theme's sidebar.php to pull in the content that is created/updated by the client on the page setup with the page template. – Andrew May 15 '14 at 16:48
0

Could you use the admin bar at the top instead? To me short messages look better up there.

add_action( 'admin_bar_menu', 'toolbar_link_to_mypage', 999 );

function toolbar_link_to_mypage( $wp_admin_bar ) {
  $args = array(
      'id'    => 'my_admin_bar_text',
      'title' => 'WELCOME TO SYDNEY',
      'meta'  => array( 'class' => 'my-toolbar-page' )
  );
  $wp_admin_bar->add_node( $args );
}   

Likewise though, you can create a short message on the sidebar, but it would have to remain pretty short. The code to do that would be:

add_action( 'admin_menu', 'register_my_custom_menu_page' );

function register_my_custom_menu_page(){
  add_menu_page( 'custom menu title', 'custom menu', 'manage_options', 'custompage', 'my_custom_menu_page', plugins_url( 'myplugin/images/icon.png' ), 6 ); 
}

function my_custom_menu_page(){
  echo "Admin Page Test";   
}

This will add a "custom menu" link to the left (just under Posts). You could name "custom menu" whatever you want, and it has the added bonus of creating a page that you can put more information on if you'd like.

Both of these options, when enabled on the network site, they can't be disabled per blog. If not network enabled, then it can be enabled and disabled per each blog BY each blog admin.

note: the first code snippet above, I don't remember where I got it, it's been chopped around for a while. The second snippet is from WP Codex, http://codex.wordpress.org/Function_Reference/add_menu_page

0

I was in a similar situation where I wanted the same content to display across all subsites of a multisite and also make the content editable via the main site's Dashboard > Widgets. I registered sidebars in the footer of the main site but out of the box, editing the main site's widgets did not update on subsites' footer widgets. In fact, subsite widgets were not the same at all.

It took a while to find a solution where (1) subsite sidebar widgets would be controlled by the main site's sidebar widgets and (2) updates to the main site's widgets will also propagate throughout the network. I found a developer had figured out a solution and documented it here: https://redtreewebdesign.com/sharing-caring-wordpress-multisite/ where the sidebar content is saved in a transient. I plugged in the code provided in my functions.php and it worked like a charm.

The post is based on a comment (https://gist.github.com/lucasstark/132511ab333f0c5fb6c4e82458ba2d20) to another post about the same topic (https://webdevstudios.com/2013/12/17/sharing-sidebars-across-a-multisite-network/) that was written by the developers of the theme I was using at the time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.