Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Integrating Vanilla with Wordpress themes
Hi,
I'm trying to integrate Vanilla into my Wordpress theme.
I've followed the instructions from Il Filosofo:
-----------
First, you need to include the WordPress files. A good place to do this is at the bottom of the Vanilla conf/database.php file, where you should put
<?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 file, adding the two lines in boldface to this section near the top of the file:
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.
--------------------
However, those changes mean that I can't enable/disable my extensions. It comes up with an Alert box that says... nothing! anyone have any idea how to solve this?
I'm trying to integrate Vanilla into my Wordpress theme.
I've followed the instructions from Il Filosofo:
-----------
First, you need to include the WordPress files. A good place to do this is at the bottom of the Vanilla conf/database.php file, where you should put
<?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 file, adding the two lines in boldface to this section near the top of the file:
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.
--------------------
However, those changes mean that I can't enable/disable my extensions. It comes up with an Alert box that says... nothing! anyone have any idea how to solve this?
0
Comments
Cee wrote: "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."