Hi!
I'm making a little simple plugin to add a dashboard widget, and it works ok for the main blog dashboard of my WPMU installation, but the widget is not showing in all other dashboards...
I simply followed WP codex documentation about adding dashboard widgets: http://codex.wordpress.org/Dashboard_Widgets_API
But I can't find anywhere any documentation on how to hook my plugin site wide to show in ALL blog's dashboards not only on the main blog :(
Please, any help would be appreciated.
PS. Of course the plugin is activated site wide...
Doesn't matter - widgets are blog-specific.
You could edit the theme (if you're using one theme sitewide) to do this:
<?php switch_to_blog(1); ?>
regualr sidebar code here
<?php restore_current_blog(); ?>
Then every blog will show the main blog's sidebar. Might get resource intensive on a larger system because of the switch_to_blog.
Thank you Andrea, but I'm looking to do it with dashboard widgets, not sidebar widgets.
So I cant use the sitewide theme for this :(
Are you using the wp_dashboard_setup
hook to get your widget registered in the dashboard?
Also, you may try putting your plugin code in mu-plugins rather than regular plugins. That way it'll always be active no matter what blog you are on.
Thank you very much tmoorewp :)
Moving the plugin to mu-plugins solves the problem.
So it seems that is no completely the same behaviour for a plugin if enable sitewide "living" in the plugins dir than living in mu-plugins.
PS. Yes, I'm using wp_dasboard_setup as explained in the WP codex. ;)
You can also take a look at the code in my simple dashboard plugin.
http://wpmudevorg.wordpress.com/project/simple-dashboard
That will show you how to customize the dashboard for all blogs, including newly created ones. (I don't add any custom widgets, but you'll get the idea if you look at the code.)
Thank you very much DeannaS! :)
I'm sure it will bring me a closer look to the dashboard manipulation ;)