title: How to call WordPress plugin function without the entire plugin
body: <p>Here is my end goal: To hide sidebars that contain no widgets which my theme currently shows as blank space.</p>
  
  <p>Background: I am able to change the layout by adding/changing classes for the content and sidebar divs. The only thing that I am having problems with is getting whether there are any widgets in a particular sidebar.</p>
  
  <p>Research: I have tried several different ways and I know what is preventing me from this functioning properly, but I do not know how to fix it.</p>
  
  <p>Understood WordPress functions:</p>
  
  <ul>
  <li><code>wp_get_sidebars_widgets();</code> - returns array of all sidebars and active widgets in each</li>
  </ul>
  
  <p>Plugin that is throwing me off that I am trying to work with:</p>
  
  <ul>
  <li><a href="http://konstruktors.com/projects/wordpress-plugins/widget-context/" rel="nofollow">Widget Context</a> - contains settings for showing/hiding widgets per page/post. I recommend it and it works as intended. I am trying to add an additional functionality to my site though and this hides the widgets on the page but it still shows the widgets as active in the <code>wp_get_sidebars_widgets();</code> function.</li>
  </ul>
  
  <p>Widget Context Plugin Functions</p>
  
  <ul>
  <li><code>function check_widget_visibility( $widget_id ) { ... }</code> - passes the widget ID and returns true or false if the widget is displayed on the page.</li>
  </ul>
  
  <p>Here is what I have tried to call the <code>check_widget_visibility</code> function in the themes sidebar.php file:</p>
  
  <pre><code>//get the sidebars and active widgets and set to a variable
  $sidebarActiveWidgets = wp_get_sidebars_widgets();
  //set variable that will be set to true if any widgets are active for this page
  $activeWidgets = false;
  //'sidebar' is the name of the sidebar that I am trying to check for active widgets
  foreach($sidebarActiveWidgets['sidebar'] as $widgetID){
      //check if the widget is visible
      if(check_widget_visibility( $widgetID )){
          //widget is visible set variable to true
          $activeWidgets = true;
          //widget is visible no reason to check others so break the foreach loop
          break 1;
      }
  }
  //check if the variable is still false
  if(! $activeWidgets){
  
      //variable is false run additional operations to extend content and remove sidebar that contains no active functions
  
  }
  </code></pre>
  
  <p>I am getting the error: <code>Fatal error: Call to undefined function check_widget_visibility()</code> I know that this function is called inside of a class so I tried doing a couple of different ways to call the function inside of the Widget Context Plugin class named <code>widget_context</code>:</p>
  
  <ul>
  <li><code>widget_context()-&gt;check_widget_visibility( $widgetID )</code>
  <ul>
  <li>Returns <code>Fatal error: Call to undefined function widget_context()</code></li>
  </ul></li>
  <li>$widget_context->check_widget_visibility( $widgetID )
  <ul>
  <li>Returns <code>Fatal error: Call to a member function check_widget_visibility() on a non-object</code></li>
  </ul></li>
  </ul>
  
  <p>Can somebody help me as to how to call a function within a theme file, where the function resided inside a plugin's class</p>
  
  <p>If you need me to post more code from the Widget Context Plugin please let me know.</p>