Saturday 15 June 2013

php - Wordpress baseurl -



php - Wordpress baseurl -

i buliding wordpress site first time. have dilema how include files. wanna create work in local , online. there in wordpress or php magic constant wich replace

http://localhost/sitename , work when upload site domain should

`http://www.sitename

i been using

$path = $_server['document_root']; include_once $path . '/sitename/wp-config.php';`

is way, of doing it? , there improve way, create links?

generally wordpress utilize created files in template directory, utilize 1 of built in functions get_template_directory()

include_once(get_template_directory() . '/inc/somefile.php');

http://codex.wordpress.org/function_reference/get_template_directory

there number of related functions this:

http://codex.wordpress.org/determining_plugin_and_content_directories

alternatively, root directory can utilize constant abspath:

echo abspath;

php wordpress

No comments:

Post a Comment