PHP Class WPDKWordPressPaths

All path and URL are auto termianted with "/" slash.
Author: =undo= ([email protected])
Show file Open project: wpxtreme/wpdk Class Usage Examples

Public Methods

Method Description
adminURL ( integer $blog_id = null, string $path = '', string $scheme = 'admin' ) : string Retrieve the url to the admin area for a given site.
homeURL ( integer $blog_id = null, string $path = '', string $scheme = null ) : string Retrieve the home url for a given site.
includesURL ( string $path = '' ) : string Retrieve the url to the includes directory.
pluginsURL ( string $path = '', string $plugin = '' ) : string Retrieve the url to the plugins directory or to a specific file within that directory.

Method Details

adminURL() public static method

Retrieve the url to the admin area for a given site.
public static adminURL ( integer $blog_id = null, string $path = '', string $scheme = 'admin' ) : string
$blog_id integer (optional) Blog ID. Defaults to current blog.
$path string Optional path relative to the admin url.
$scheme string The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
return string Admin url link with optional path appended.

homeURL() public static method

Returns the 'home' option with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is overridden.
public static homeURL ( integer $blog_id = null, string $path = '', string $scheme = null ) : string
$blog_id integer (optional) Blog ID. Defaults to current blog.
$path string (optional) Path relative to the home url.
$scheme string (optional) Scheme to give the home url context. Currently 'http', 'https', or 'relative'.
return string Home url link with optional path appended.

includesURL() public static method

Retrieve the url to the includes directory.
public static includesURL ( string $path = '' ) : string
$path string Optional. Path relative to the includes url.
return string Includes url link with optional path appended.

pluginsURL() public static method

You can hardcode the plugin slug in $path or pass __FILE__ as a second argument to get the correct folder name.
public static pluginsURL ( string $path = '', string $plugin = '' ) : string
$path string Optional. Path relative to the plugins url.
$plugin string Optional. The plugin file that you want to be relative to - i.e. pass in __FILE__
return string Plugins url link with optional path appended.