Jump to content

Integrating Wordpress and WHMCS


josepht

Recommended Posts

Ok, let's get a few things out of the way immediately.

 

If your answer is simply going to be "use the Bridge Plugin (or similar)" or "use the WHMCS Integration service", then please don't post. I'm not interested in duplicating my wordpress theme into a WHMCS skin (and having to make sure any changes to one are made in the other), nor am I interested in simply displaying a iframe containing WHMCS somewhere on my wordpress site.

 

 

What I want to do is be able to call the wordpress head and footer functions (and others as necessary).

 

In the past, it was possible to do that in the template files use {php} tags to require wp-load.php and then make use of the get_header() and get_footer functions where needed. Now obviously that is not ideal (since it is definitely not future proof), so ideally I'd like to be able to do it via hooks, however I can't seem to get it working correctly.

 

<?php
add_hook('ClientAreaPage', 1, function($vars) {
   define('WP_USE_THEMES', FALSE);
   require('/path/to/wordpress/wp-load.php');

});

?>

 

seems to just return a 500 error, so I' obviously doing something wrong, but the documentation on Hooks is rather limited. Would anyone be able to provide any help?

 

Similarly, as I won't be able to just call get_header() and get_footer() in the correct part of the template files, what would be the best way to go about calling those functions via hooks?

 

Thank you

Link to comment
Share on other sites

Don't put wp-load.php in a hook just add it at the very top of the hook file then add your hooks.

 

if (!defined("WHMCS"))
die("This file cannot be accessed directly");
define('WP_DEBUG', false);
define('WP_USE_THEMES', false);
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );

// then add hooks

add_hook('ClientAreaHeaderOutput...

 

 

If you just hook into get_header() and get_footer you are going to have a bunch of open and misplaced html tags.

Also, Wordpress jquery conflicts with the WHMCS custom jQuery and must be removed or some of WHMCS functionality will break.

 

I do these on a theme by theme basis and there's quite a bit more to it than you might expect but if done right it works good.

 

 

Jim

 

- - - Updated - - -

 

Also, could I ask what theme you are using?

Edited by JimW
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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