Including wordpress functions
-
Hello, I’m coding first plugin (and probably doing this wrong!). My current directory structure goes something like this:
-index.php has plugin declaration in comments at start of file
-standard.php has things like constant declarations & my way of including wp-load into other files which goes like this:function iam_require_load()
{
//suppress warnings of constant
if(@constant(‘ABSPATH’)!=null){
require_once ABSPATH.’wp-load.php’;
} else {
require_once realpath(‘../../../’).’/wp-load.php’;
}
}Which I’m assuming is a bad way to do that. Basically I made this with because I need to use things like “get_site_url()” and $wpdb in various files both in the same directory and in my templates sub directory.
I read a couple blogs which said I should not be including wp-load in a production wordpress and so I exclaimed “But then how do I include these things I need!?!?” Which lead me to the assumption that I’m doing something horribly wrong.
Any help is much appreciated! : D
- The topic ‘Including wordpress functions’ is closed to new replies.