I have created a function in my plugin
myplugin with the name
foo, how to call it from the frontend?
closed as off-topic by s_ha_dum♦ Oct 11 at 21:47
This question appears to be off-topic. The users who voted to close gave this specific reason:
The same way you would any other:
Active plugins are loaded before the theme files
You may want to check that your plugin is activated and the function is available so things dont go pear shaped if you forget to activate it, like:
Also keep in mind
You will eventually want to use actions and filters, as they're safer and ebtter practice, you can continue to read up on that here
Active plugins are loaded (as in technically - their files are included and processed by PHP during WordPress load) by the time theme templates run.
So your function should be available and can be called as any other function:
You don’t. A Theme should not rely on a plugin except in a very controlled environment. Use actions and filters instead.
So in your theme you might use:
… or …
In your plugin you use