Jump to content

How to call wordpress header in header.tpl


Recommended Posts



I would like to call the wordpress header in my header.tpl. But several options have left me nowhere... Calling the WP functions has not helped, like this:


global $wpdb, $table_prefix; 
require( 'http://www.evoned.nl/wp-load.php' );


And then use the include_php function in the .tpl file. No luck... already 6 hours spent!


Any ideas?

Link to comment
Share on other sites

You can't include this way..

<?php include('http://www.evoned.nl/wp-config.php');  ?> 


correct way: (use relative path to wp-load.php

	define('WP_USE_THEMES', false);




Or the other method is to create a getheader.php in the rooth of WP folder. and add the following code.


	define('WP_USE_THEMES', false);



And then add the following code in the header.tpl file under your WHCMS theme folder.

(assumed that you installed WP in the root of the domain)

echo file_get_contents('http://www.yourdomain.com/getheader.php');




Hope this helps you. :)

Link to comment
Share on other sites

  • 1 year later...

I have managed to do this once. I'll need to find where i got the info from but i remember it used a cron to run every so often and take the info from the wp header/footer and update the header/footer on whmcs. Or you can just make a static whmcs theme based on your wordpress layout and if you change any of your wp links you'd have to manually change the whmcs theme.

Link to comment
Share on other sites

  • 6 years later...

I took a different approach. 

I created a hook called navigation.php to change the WHMCS menu to have the Wordpress menu items. In my header.tpl I then just modified the style to match my Wordpress style. This is the safest option.  


add_hook('ClientAreaNavbars', 1, function ()
    // Load Wordpress can get the menu itmes
    $wpMenu = wp_get_nav_menu_items('Top Menu');
    // Get the current navigation bars.
    $primaryNavbar = Menu::primaryNavbar();
    $secondaryNavbar = Menu::secondaryNavbar();
    // Remove unecessary menu items from WHMCS
    $primaryNavbar->removeChild('Network Status');
    $primaryNavbar->removeChild('Contact Us');

    // Keep menu in order
    $order = 1;

    // Add a WHMCS menu for each Wordpress menu
    foreach($wpMenu as $item) {


Link to comment
Share on other sites

  • 2 weeks later...
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated