How might I use a plugin function site-wide if the plugin isn't active site-wide?

Hi folks,

I’m running a multisite install for which I have a plugin that I do not necessarily want to run network-wide. It is used on the main site, and may be used on child sites in the future. BUT, there is a feature of the plugin – it’s WPML to be specific – that I need to appear everywhere. And, of course, for sites where the plugin isn’t used I get a “Fatal error: Call to undefined function”.

Basically I want my language indicators to appear network-wide without activating the plugin network-wide. Am I dreaming? Is there a way? I thought using the blog switcher would be enough, but that doesn’t seem to work. Even though the language switcher is within the part of the header that uses

<?php
global $switched;
switch_to_blog(1);
?>

I still get the error.

thanks!

-jennyb

  • jennybeaumont
    • Design Lord, Child of Thor

    Me again,

    Am thinking it’s not specific to a plugin, but simply a reality of a network install. I’m realizing that I had a similar problem with another plugin where I wanted plugin-specific content to show on one blog, but that was coming from another. I had to install the plugin on the child site in order for it to work (ad banners).

    May instead have to start looking at other ways to streamline the network so that, as the number of sites grows, we don’t get slowed down…

    thanks guys!

  • DavidM
    • DEV MAN’s Mascot

    Hi Jenny,

    You’re right, it’s more a general coding concern surrounding Multisite implementation of particular features. What I meant by it being plugin-specific is that you’d have to alter specific code in that plugin to limit specific features.

    Unfortunately, we don’t have access to that code to assist you. Though the developers may just know exactly where to look.

    -David

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.