eUttaranchal

Re-Writing the Web

Archive for the ‘Wordpress Hacks’ Category

Running WordPress Queries in Non-WordPress Pages

Posted by Bhupendra On July - 17 - 2010

At times you might want to run the WordPress queries or wordpress functions in the page located outside the wordpress templates.

Thanks to wordpress for providing a very simple solution to this.

You just need to include the file called “wp-load.php” in the non-wordpress file before calling any WP functions and then you can run wordpress queries or call any wordpress function in that page.

wp-load.php is located in the root folder of your wordpress installation.

eg. if you have installed wordpress in your domains root folder, wp-load.php will be there in your public_html or httpdocs folder as applicable.
if you have installed wordpress in a folder say wp in your domain root, the wp-load.php shall be located in public_html/wp/ folder.

Include this file in your non-wordpress file using a require statement at the very beginning of the file.

require('../wp-load.php');

Popularity: 1% [?]

This is annoying if WordPress asks for FTP username/password everytime you try to install or update plugin from admin panel.

Here is the quick hack to this.

1. Open the wp-config.php file (this will be located in the root of your wordpress installation)

2. Add the following line of code just after define(‘NONCE_KEY’, ‘put your unique phrase here’);

/* FTP login settings */
define('FTP_HOST', 'localhost');
define('FTP_USER', 'yourftpusername');
define('FTP_PASS', 'yourftppassword');

Note: Be sure to replace yourftpusername to your website’s FTP user name and yourftppassword to your website’s FTP password.

3. Upload the updated file. It works!

Popularity: 16% [?]