Can anyone walk me through, or tell me what code is needed so that I can use all of the WordPress functions and access my wordpress database from anywhere on my site?
Thank you!
Can anyone walk me through, or tell me what code is needed so that I can use all of the WordPress functions and access my wordpress database from anywhere on my site?
Thank you!
to start with you need this on any page you plan on plugging into your WP install:
<?php require('path_to/wp-blog-header.php'); ?> <-- use the proper path
from there, sql queries take the form of :
$wpdb->get_results ...
Can you tell me which parts of the header specifically are required. What happens if I want to pull from 2 different WordPress databases on the same page? Any help would be appreciated.
If you want to use "WP functions" on a site/file, as you stated in your title - you need exactly the code whooami posted. Not parts of it.
You cannot pull data from 2 databases with this method.
If I install 2 instances of WordPress on my site then but within the same database (and just with different prefixes i.e wp_ and articles_) can I use this method and then somehow just specify which prefix to pull from?
- Kyle
This topic has been closed to new replies.