Пример #1
0
function ts_essentials_fontawesome_class($icon, $default = '')
{
    $icon = trim($icon) ? trim($icon) : $default;
    if (ts_starts_with($icon, 'fa-')) {
        $icon = substr($icon, 3);
    } elseif (ts_essentials_starts_with($icon, 'icon-')) {
        $icon = substr($icon, 5);
    }
    return trim($icon) ? esc_attr('fa fa-' . $icon) : '';
}
Пример #2
0
/**
 * this is mainly used for when users upgrade the theme by changing the theme directory
 * to something like [themename]-[version#]. theme files that were saved into the theme options
 * may still have the original/outdated uri.
 */
function ts_correct_image_uri($uri = '')
{
    if (preg_match("/(wp\\-content\\/themes\\/).*(" . TS_THEMENAME . ").*(\\/images\\/).*(gif|jpg|png)/i", $uri)) {
        $filename = pathinfo($uri, PATHINFO_BASENAME);
        return get_template_directory_uri() . '/images/' . $filename;
    } elseif (ts_starts_with($uri, '[theme_directory]')) {
        return strip_tags(do_shortcode($uri));
    }
}