Support » Fixing WordPress » Calling a function from plugin to template

  • I am trying to call a plugin function from the plugin directory into my header of my main page template. I am getting an error because it’s looking for the plugin in my template directory. What am I doing wrong?

    Here’s my code:

    <?php get_header(); ?>
    <?php include(zd_multilang_menu('plugin_directory')); ?>

    I am editing the Main Index Template.
    You can see the error code.

    Any assistance would be most appreciated!

    Thank you, Debbie

Viewing 4 replies - 1 through 4 (of 4 total)
  • Have you tried the codex and the plugin page?
    Which plugin are you using?
    What are the instructions for use for the plugin?
    Is there another php command you could use?
    Does the command you are using work with other plugins?
    Does the command work with another theme (and another plugin)?

    Doing those things is not a guarantee for an answer, but it does make it easier for people to respond and also makes it easier to figure out what is going on.

    Hope it helps 🙂

    No, I’ve never tried this before and I know enough about PHP to make me dangerous!

    The plug-in is zdmultilang. The author said I could call the function zd_multilang_menu() but to put it between the <ul><li> because of how it should display. That’s all he said. So, I tried what I did there and it’s not working.

    When I tried a different command, it said that it couldn’t find the function from the main wordpress directory and I have no clue how to point it to the plugins directory.

    I’m lost and in way over my head I guess. But thank you for trying!

    You should just call it like this:

    <?php if(function_exists('zd_multilang_menu')) zd_multilang_menu(); ?>

    Greenshady, I just tried your suggestion and put it everywhere I could to try to get it to work.

    It would not accept it on the functions.php and even though I could insert the code in many different places, it still isn’t allow the menu to show up either above my header (kubrick image) nor below it.

    Thank you for trying to help me though. I really appreciate it.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Calling a function from plugin to template’ is closed to new replies.