OK, so you have a WordPress blog and are thinking about adding a vBulletin message board to it and want it to appear seamlessly within your WP theme. This post will show you how to do it.
The way you go about accomplishing this is by creating two Plugins under vBulletin. Before we do anything we have to make sure that the Plugin/Hook system is enabled. For this select vBulletin Options under the vBulletin Options from the control panel. Select the Plugin/Hook System option in the select list and make sure its enabled. Once you’ve done that, you’ll need to create a couple plugins. Click on the Add New Plugin option under the Plugins & Products on the left hand side of the control panel. Create a plugin with the Hook Location specified as global_start and the default execution order. Give it the title of WP Header and in the Plugin PHP Code field, write the following:
$wp_header = ob_get_contents();
Now let’s examine what I did here. Bascially, I’m invoking two WordPress PHP files, wp-load.php from the main installation and header.php from my theme’s directory. I capture the content of it in the
$wp_header variable which we’ll use later.
Make sure you change the plugin to be active by clicking on the Yes radio button and save the plugin.
Now we’ll create another plugin for the footer. Once again, specify the Hook Location as global_start, give it the title of WP Footer and select the default execution order. In the Plugin PHP Code field write the following:
$wp_footer = ob_get_contents();
In this plugin we’re capturing the theme’s footer.php in the
Now we need to insert the two pieces of data we captured into the vBulletin theme. For that let’s go to Style Manager under the Styles & Templates group in the left control panel. Once there, select Edit Templates from the drop down list which should give you a listing of all the editable files in your theme. Double-click on header from the list and simply add the following line of code as the first line in the file:
Save it and go back to the list of editable files and edit footer. Make sure the following line of code is the last line in the file:
Save it and you’re done.
Well, almost. Depending on the version of vBulletin you have you might get a PHP error which says something like “sanitize_url function has already been defined”. Check the vBulletin file its happening in, download it and rename both occurrences of the function to something like
vb_sanitize_url and now you’re done.