WordPress.org

Forums

Calling a function from plugin to template (5 posts)

  1. dmahler
    Member
    Posted 6 years ago #

    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(); ?>
    
    <ul>
    <?php include(zd_multilang_menu('plugin_directory')); ?>
    </ul>

    I am editing the Main Index Template.
    http://howquick.net
    You can see the error code.

    Any assistance would be most appreciated!

    Thank you, Debbie

  2. design_dolphin
    Member
    Posted 6 years ago #

    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 :-)

  3. dmahler
    Member
    Posted 6 years ago #

    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!

  4. Justin Tadlock

    Posted 6 years ago #

    You should just call it like this:

    <?php if(function_exists('zd_multilang_menu')) zd_multilang_menu(); ?>
  5. dmahler
    Member
    Posted 6 years ago #

    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.

    Debbie

Topic Closed

This topic has been closed to new replies.

About this Topic