• Need to code what I think should be a fairly simple plugin but have a few newbie type questions about how the plugin system works in relation to templates.

    I need to code a small plugin that will get called from within a template to provide a small string of text based on the current URL of the visitor.

    I’m having a little trouble figuring out which action I’d use or if that’s even the route to go.

    Basically I just want the template to have:

    <?php my_plugin_function(); ?>

    Somewhere in it and then that calls the plugin. But not getting what I’d actually put in my plugin to make that possible or at least SOMETHING like that possible.

    Any help is appreciated. And sorry for whats probably a ridiculously obvious question.

    Jamie

Viewing 2 replies - 1 through 2 (of 2 total)
  • Probably don’t need a plugin for this. You can just create the my_plugin_function(); in the functions.php file of the theme. Then, on any page template you can call the function like you want:

    <?php my_plugin_function(); ?>

    Thread Starter methnen

    (@methnen)

    Thanks, yes, I realized how stupid my question was anyway about 5 minutes after I asked it. I did get it to work within a plugin which I like because I didn’t want to dirty up the template that much but either way I was making it out to be more complicated than it really was.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘First Time WordPress Plugin Questions’ is closed to new replies.