Example #1
0
/**
 * Sets default subdirectories for various static file types
 * 
 * @param   string    Type of file we're looking for
 * @return  string    Name of subdirectory where file can be found
 */
function get_file_subdir($type)
{
    global $asset_helper_subdir;
    $defaults = array('css' => '/css', 'js' => '/js', 'img' => '/images');
    // Is this directory overridden?
    if (isset($asset_helper_subdir[$type])) {
        $subdir = $asset_helper_subdir[$type];
    } else {
        // WordPress standard is to keep CSS/JS in the theme directory,
        // so let's go with that unless a subdirectory is specified.
        if (is_wordpress() && $type != 'img') {
            $subdir = '';
        } else {
            $subdir = $defaults[$type];
        }
    }
    return $subdir;
}
function dir_path_for($type = 'js')
{
    $subdir = array('css' => '/stylesheets', 'js' => '/javascripts', 'img' => '/images');
    if (is_wordpress()) {
        $dir_path = TEMPLATEPATH . $subdir[$type] . '/';
    } else {
        $dir_path = $subdir[$type] . '/';
    }
    return $dir_path;
}