WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just developed a calendar plugin.
To display a calendar in a template, I call do_shortcode(args...);.

This works fine.

But how can I call a function from my plugin that will return data?

I don't want to use include_once - I really just want to call a function E.g.

$events = calendar->getEvents(args...)
share|improve this question
Is there a reason why the data is not included as a shortcode parameter? – Wyck Aug 18 '11 at 18:47
I thought short code only outputted data, not returning data. – Steven Aug 18 '11 at 19:02
up vote 2 down vote accepted

As long as the plugin is active, the function will work perfectly fine from any template.

share|improve this answer
Thanks, you helped me on the right track. What I needed to do, was to create a function in my my_plugin.php that called the function I really wanted from some_other_file.php. I tried calling that function directly... and that did of course not work :) – Steven Aug 18 '11 at 19:01
Excellent, glad to help. – Pippin Aug 18 '11 at 20:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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