I am trying to call plugins on a theme page. Specifically I am after the 'User Avatar' theme but their will be other later.

How do I call a plugin on a theme?

Presumable something linke <?php ...plugin name... ;?> but that isn't it. Any ideas.


  • What do you mean by "call plugins on a theme page?" That could mean several things. Can you be more explicit in what you want to happen? Feb 16, 2011 at 15:28

3 Answers 3


You must check the documentation of the plugin.

  1. Is it supporting shortcodes? Do sometingh like <? do_shortcode('[plugin_shortcode]'); ?>
  2. Has function to call in the theme? Do something like <? my_plugin_function(); ?>

Other options would be

function_exists( 'first_loaded_plugin_fn' ) AND do_something();
class_exists( 'initial_plugin_class' ) AND do_something();

The best chance is the callback function from register_activation_hook( $file, $function ); if the plugin does not only offer a template tag or similar basic functionality.


Some option from the plugin that get's added on init/activation:

echo  ! empty( get_option( 'plugin_option_name' ) ) ? 'activated' : 'not active';


Check if the plugins_loaded hook has some action (<-- link)

echo has_action( 'plugins_loaded', 'fn_to_check') !== false ? 'activated' : 'not active';

You'll hacve to take a closer look at the returned result. The result may contain the priority too.


you could do it through shortcode like keatch said or you could create a function in your plugin that would be called from within your theme.

look here, section 7. Creating the user function

you are supposed to put the output of your plugin into that function (keep in mind that you should use return to print out the output, and not echo, since with echo you don't have enough control over where your output will end up).

  • also make sure to use if cases as shown in kaisers answer, it's allways good to have this checks..
    – tkit
    Feb 16, 2011 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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