dick1980 Posted June 21, 2010 Share Posted June 21, 2010 Hi, 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: <?php include('http://www.evoned.nl/wp-config.php'); global $wpdb, $table_prefix; require( 'http://www.evoned.nl/wp-load.php' ); get_header(); ?> 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 More sharing options...
anunay Posted June 21, 2010 Share Posted June 21, 2010 You can't include this way.. <?php include('http://www.evoned.nl/wp-config.php'); ?> correct way: (use relative path to wp-load.php <?php define('WP_USE_THEMES', false); require('../../wp-load.php'); ?> --------------------------------------------- Or the other method is to create a getheader.php in the rooth of WP folder. and add the following code. <?php define('WP_USE_THEMES', false); require('../../wp-load.php'); get_header(); ?> 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'); [php] Hope this helps you. Link to comment Share on other sites More sharing options...
kjmiami23 Posted July 18, 2011 Share Posted July 18, 2011 HI Dick1980, Did you manage to work that out as i am having the same problem? Thanks. Link to comment Share on other sites More sharing options...
mojahed Posted July 18, 2011 Share Posted July 18, 2011 why you don't just integrate the WHMCS template to match your wordpress theme Link to comment Share on other sites More sharing options...
WebsiteIntegrations Posted July 18, 2011 Share Posted July 18, 2011 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 More sharing options...
jmtech Posted November 2, 2017 Share Posted November 2, 2017 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 require("../jmtech/wp-load.php"); $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('Announcements'); $primaryNavbar->removeChild('Knowledgebase'); $primaryNavbar->removeChild('Network Status'); $primaryNavbar->removeChild('Home'); $primaryNavbar->removeChild('Store'); $primaryNavbar->removeChild('Contact Us'); // Keep menu in order $order = 1; // Add a WHMCS menu for each Wordpress menu foreach($wpMenu as $item) { $primaryNavbar->addChild($item->title) ->setUri($item->url) ->setOrder($order); $order++; } } Link to comment Share on other sites More sharing options...
Esi Posted November 15, 2017 Share Posted November 15, 2017 Hi jmtech, your solution works fine even in whmcs > 7.3 version? i have a wp site under other server account, according to you how can i implement your solution? Thank you for your suggestions. Best regards Link to comment Share on other sites More sharing options...
Recommended Posts