WordPress.org

Ready to get started?Download WordPress

Forums

How to add an external function inside wordpress header (5 posts)

  1. jgalileolopez
    Member
    Posted 2 years ago #

    Hello everyone. I am very new to wordpress so please forgive my ignorance. I have a custom 3rd party application running side by side with wordpress. My application is in root of domain and WordPress is in sub domain and own db. My php application has it's own login function that displays like this

    user not logged in: Good Morning, Login | Register
    user is logged in: Good Morning, Username - Logout

    I would like to display this function inside the header of my wordpress installation and I am running into a wall.

    I asked on the 3rd party apps forums and got this response, but i can't get it to work.

    In your index.php or whatever main controller file you have for "WP" you'll need to add this line:

    require_once('/full/path/to/your/3rdpartyapp/functions/config.php');
    Now the 3rd parties app backend is loaded into your WP.

    Then try:

    global $login_include;

    Then try to put your $login_include anywhere in your WP theme however it works.. never played with it.

    Full code is as follows:

    chdir('/full/path/to/your/3rdpartyapp/functions/');
    require_once('config.php');
    global $login_include;
    chdir('/full/path/to/your/wordpress/');

    echo $login_include;

    You should see something but you'll need a programmer to position the $login_include to where you want your login include to be located in your WP.

    I have tried to do this in the index.php file within the root directory of where my WP is installed but I don't get a thing to display.

    I am wondering if I am adding the code to the right file or if this is even the best way to proceed.

    As stated above all i want is to display this function so that the user can see they are logged in or out of my app.

    Any assistance in getting me to the right place is greatly appreciated. Thanks in advanced.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try adding it to your theme's header.php template file.

  3. jgalileolopez
    Member
    Posted 2 years ago #

    Thanks for the tip, do you know how this should look in header.php.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Sorry - no idea.

  5. jgalileolopez
    Member
    Posted 2 years ago #

    thanks for the tip anyways I appreciate it.

Topic Closed

This topic has been closed to new replies.

About this Topic