wordpress: Commonly used path reference

Some of the commonly used wordpress path references:

// gives you the url of your theme dir. works for childtheme.
get_stylesheet_directory_uri()

// get child stylesheet
get_stylesheet_uri()

// gives you the root theme folder, ie xxx/wp-content/themes
get_theme_root()

// this gives you the absolute path
get_template_directory();

// gives you the plugin url
plugins_url();

// gives you the plugin dir path
plugin_dir_path();

// ABSPATH refers to the directory in which wordpress is installed, for eg /var/www/htdocs/wordpress
ABSPATH 

// Absolute path to plugins dir
WP_PLUGIN_DIR  

// Absolute path to plugin URL
WP_PLUGIN_URL

// gives your the url of the homepage
site_url() 

another good resource is http://codex.wordpress.org/Determining_Plugin_and_Content_Directories

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.