The folks at Vanilla have a handy guide to integrating the database tables and cookies of WordPress and Vanilla, but they don’t explain how to use the WordPress themes in Vanilla. It’s pretty simple.
First, you need to include the WordPress files. A good place to do this is at the bottom of the Vanilla
conf/database.php
<?php require_once('../wp-blog-header.php'); ?>
(of course make sure that’s the path to wp-blog-header.php–yours may be in a different directory).
Second, you need to re-connect WordPress to the database, because Vanilla will close the connection early. Edit Vanilla’s
library/Framework/Framework.Class.MySQL.php
class MySQL extends Database {
function CloseConnection() {
if ($this->Connection) @mysql_close($this->Connection);
global $wpdb;
$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
}
That’s it! Now you can use WordPress functions, such as get_header()
, in the Vanilla theme.
18 Comments
hey there,
thanks for this. shame it doesn’t work for me for some reason. i followed your instruction, but now i get this error:
Fatal error: Cannot instantiate non-existent class: wpdb in Framework.Class.MySQL.php on line 18
line 18 being:
$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
i included wp-blog-header.php in conf/database.php, but so far no wp functions are working. i’d really appreciate some help. normaly i’d think it was me doing something wrong, like usual, but this is really starightforward. i think…
boris, probably
'../wp-blog-header.php'
is not the right path to wp-blog-header.php. You may need to adjust accordingly.Filosofo,
I attempted to follow your directions too, and my site went blank. No source code or anything on the forum page. Then when I restored the original settings, everything was fine.
Can you further explain the following steps?
1. “Add to the bottom of your Vanilla conf/database.php file.”
I changed the file path, but it still didn’t work. This was the part that blanked my site out. Does it matter that there’s already one
Enigmatix, those directions assume that the PHP tags are closed at the bottom of the file (like
?>
). You may need to adjust accordingly.Also, try turning on error reporting in PHP to see what errors are being thrown instead of just getting a blank screen.
I did as you laid out above and everything works fine, no errors. I used Vanilla 1.1.1 and WP 2.1.2. However once I did your steps above Vanilla started inserting backslashes where ever it saw single or double quotes when posting new entries. Did this happen to you to? Do you have any idea what could be causing this, magic quotes are turned off on my server.
Mark, which steps caused the backslashes to appear?
Well I did both steps above, but its the require_once(‘../wp-blog-header.php’);
That causes the backslashes to start coming in. Heres my test forum:
http://iworkoutnow.com/vanilla/
login: admin
pass: admin
and my php info: http://iworkoutnow.com/vanilla/info.php
Clean install of Vanilla 1.1.1 and WP 2.1.2, no extensions default theme. You can see how it works in the two test posts I have there.
Mark,
The slash problem seems to be caused by the fact that recent versions of WordPress slash everything that gets posted. Unfortunately, Vanilla isn’t expecting this.
You should keep those slashes from appearing initially by adding, right after
require_once(’../wp-blog-header.php’);
, the following lines:$_GET = stripslashes_deep($_GET );
$_POST = stripslashes_deep($_POST );
$_COOKIE = stripslashes_deep($_COOKIE);
Thank you sir!
Works perfectly!
Hi,
this sounds very nifty, but I dont think I get what it actually does..
I would like vanilla forum to look like my website, smooth and clean, but I’m also very new at both php and the forum stuff.
My website is http://www.cafe-nightclub.com and the forum is located at http://www.cafe-nightclub.com/forum
Am I doing something wrong, or is it in fact, working now?
Same question as above from Kasper and (also?) still searching for an easy solution for this. It appears that this will require playing with some files. Any pointers would be greatly appreciated.
Thanks and take care.
Thanks very much for these instructions. I tried them and unfortunately got this error;
Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in /home/.lock/user/site/messageboard/conf/database.php on line 52
Warning: require_once(http://www.mysitename.net/wp-blog-header.php) [function.require-once]: failed to open stream: no suitable wrapper could be found in /home/.lock/user/site/messageboard/conf/database.php on line 52
Fatal error: require_once() [function.require]: Failed opening required 'http://www.mysitename.net/wp-blog-header.php' (include_path='.:/usr/local/php5/lib/php') in /home/.lock/user/site/messageboard/conf/database.php on line 52
Hello! Help solve the problem.
Very often try to enter the site, but says that the password is not correct.
Regrettably use of remembering. Give like to be?
Thank you!
Hi,
Love the ease of your fix, but how do I uninstall these settings cleanly? Doing it in reverse doesn’t seem to work.
I need to install the attachments2 extention, which is seemingly incompatible with these settings. Is there anyway I can work around that? If so, that would be even better.
Thanks
Hello,
Thanks for this tutorial. It worked almost totally as-is, except that Ajax broke. This meant that I could not enable/disable extensions, remove posts or check for updates. I changed it from a relative path (../wp-blog-header.php) to an exact path in my server (/var/www/mydomain/wp-blog-header.php) and Ajax works perfectly now.
Thanks again!
Thanks mate
You rule!
I am having trouble getting a script to run on my WordPress blog.
Here is the error…
Warning: require_once() [function.require-once]: URL file-access is disabled in the server configuration in /home/content/s/s/e/sself0117/html/financial-aid-secrets.com/wp-content/themes/big-blue-01/footer.php on line 7
Warning: require_once(http://stephen-henderson.com/blog-linking/showlink.php?id=1) [function.require-once]: failed to open stream: no suitable wrapper could be found in /home/content/s/s/e/sself0117/html/financial-aid-secrets.com/wp-content/themes/big-blue-01/footer.php on line 7
Can you help me at all with this?
Thank you!
tesisat yikama ve temizleme hizmetleri vermekteyiz.
30 Trackbacks
[…] UpdateAn additional tip on how to incorporate your theme with Vanilla. […]
[…] But the guides above doesn’t cover how to use WP’s functions in Vanilla. So, you’ll have to refer to one at Il Filosofo for that. […]
[…] ????????????Vanilla???WP??????????????? Il Filosofo??????? […]
[…] ????????????Vanilla???WP???????????????Il Filosofo??????? […]
[…] ????????????Vanilla???WP???????????????Il Filosofo??????? […]
[…] ????????????Vanilla???WP???????????????Il Filosofo??????? […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]
[…] sollte sich diesen Thread durchlesen. Für die Verwendung von WP-Funktionen in Vanilla findet man hier Informationen. Layout-Anpassungen in Vanilla werden hier […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]
[…] guides above doesn’t cover how to use WP’s functions in Vanilla. So, you’ll have to refer to one at Il Filosofo for […]
[…] guides above doesn’t cover how to use WP’s functions in Vanilla. So, you’ll have to refer to one at Il Filosofo for […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]
[…] guides above doesn’t cover how to use WP’s functions in Vanilla. So, you’ll have to refer to one at Il Filosofo for […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]
[…] Integrating Vanilla Forum and WordPress Themes May.24, 2008 in Uncategorized 这个是介绍在Vanilla中使用wp的风格。原文这里 […]
[…] Zum Schluss kann Vanilla natürlich noch an die eigenen Bedürfnisse angepasst oder mit dem WordPress Theme verschmolzen […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]
WordPress Themes…
Its just great! There are so many sites, which offer free wordpress themes. And if you are searching for a real unique design, there are thousands of programmers and designers which offer their work. Nice to be part of the great wordpress-community. :-…
Propecia store…
Here you can buy propecia and grow hair…
online publicity…
Thanks for your great comments and insights. I absolutely agree that in any CPG product line, everything goes back to sound branding first. However, packaging can and should leverage the strengths and uniqueness of the brand for the consumer. Color, st…
how to earn money…
Powered by FeedBlitz Subscribe to this blog\’s feed/ a Categories Blog Brand Blogging Your Brand Brand Audit Brand Confusion Business and Marketing Strategies Cool products and biz models Corporate Culture Credibility Case Studies Crediblity Marketin…
[…] guides above doesn’t cover how to use WP’s functions in Vanilla. So, you’ll have to refer to one at Il Filosofo for […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]
[…] Integrating Vanilla Forum and WordPress Themes – Il Filosofo – (of course make sure that’s the path to wp-blog-header.php–yours may be in a different directory). Second, you need to re-connect WordPress to the database, because Vanilla will close the connection early. Edit Vanilla’s … […]
[…] Enlace Integrating Vanilla Forum and WordPress Themes […]
[…] Enlace Integrating Vanilla Forum and WordPress Themes […]
[…] Enlace Integrating Vanilla Forum and WordPress Themes […]
[…] 不过以上的指导并没介绍在Vanilla中使用WP的功能的部分,这个内容可以参照Il Filosofo上的一篇文章。 […]