Skip to content

Instantly share code, notes, and snippets.

@geraintp
Created November 12, 2013 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geraintp/7433502 to your computer and use it in GitHub Desktop.
Save geraintp/7433502 to your computer and use it in GitHub Desktop.
<?
# Prepare the location of the slider's folder to enable movement accross folders
// $path = dirname(__FILE__);
// $path = str_replace('\\', '/', $path);
// $path = str_replace(str_replace('\\', '/', ABSPATH), '', $path);
// $path = trailingslashit(site_url()) . $path;
// $path = trailingslashit($path);
# Fix wrong path code!
$file = str_replace('\\','/', dirname(__FILE__)); // sanitize for Win32 installs
$file = preg_replace('|/+|','/', $file ); // remove any duplicate slash
$path = get_template_directory();
// get relative path from theme dir
$file = preg_replace('#^' . preg_quote($path, '#') . '/#','',$file);
// Build correct URL
$path = trailingslashit(get_template_directory_uri()) . trim($file, '/');
$path = trailingslashit($path);
$this->url = $path;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment