Пример #1
0
/**
 * tarski_doctitle() - Returns the document title.
 * 
 * The order (site name first or last) can be set on the Tarski Options page.
 * While the function ultimately returns a string, please note that filters
 * are applied to an array! This allows plugins to easily alter any aspect
 * of the title. For example, one might write a plugin to change the separator.
 * @since 1.5
 * @param string $sep
 * @return string $doctitle
 * @hook filter tarski_doctitle
 * Filter document titles.
 */
function tarski_doctitle($sep = '·')
{
    $site_name = get_bloginfo('name');
    if (is_404()) {
        $content = __(sprintf('Error %s', '404'), 'tarski');
    } elseif (get_option('show_on_front') == 'posts' && is_home()) {
        if (get_bloginfo('description')) {
            $content = get_bloginfo('description');
        }
    } elseif (is_search()) {
        $content = sprintf(__('Search results for %s', 'tarski'), attribute_escape(get_search_query()));
    } elseif (is_month()) {
        $content = single_month_title(' ', false);
    } elseif (is_tag()) {
        $content = multiple_tag_titles();
    } else {
        $content = trim(wp_title('', false));
    }
    if ($content) {
        $elements = array('site_name' => $site_name, 'separator' => $sep, 'content' => $content);
    } else {
        $elements = array('site_name' => $site_name);
    }
    if (get_tarski_option('swap_title_order')) {
        $elements = array_reverse($elements, true);
    }
    // Filters should return an array
    $elements = apply_filters('tarski_doctitle', $elements);
    // But if they don't, it won't try to implode
    if (check_input($elements, 'array')) {
        $doctitle = implode(' ', $elements);
    }
    echo $doctitle;
}
Пример #2
0
/**
 * Returns the document title.
 *
 * The order (site name first or last) can be set on the Tarski Options page.
 * While the function ultimately returns a string, please note that filters
 * are applied to an array! This allows plugins to easily alter any aspect
 * of the title. For example, one might write a plugin to change the separator.
 *
 * @since 1.5
 * @deprecated 3.2.0
 *
 * @param string $sep
 * @return string
 *
 * @hook filter tarski_doctitle
 * Filter document titles.
 */
function tarski_doctitle($sep = '·')
{
    _deprecated_function('wp_title', '3.2.0');
    $site_name = get_bloginfo('name');
    $content = trim(wp_title('', false));
    if (is_404()) {
        $content = sprintf(__('Error %s', 'tarski'), '404');
    } elseif (get_option('show_on_front') == 'posts' && is_home()) {
        $content = get_bloginfo('description', 'display');
    } elseif (is_search()) {
        $content = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query()));
    } elseif (is_month()) {
        $content = single_month_title(' ', false);
    } elseif (is_tag()) {
        $content = multiple_tag_titles();
    }
    $elements = strlen($content) > 0 ? array('site_name' => $site_name, 'separator' => $sep, 'content' => $content) : array('site_name' => $site_name);
    if (get_tarski_option('swap_title_order')) {
        $elements = array_reverse($elements, true);
    }
    // Filters should return an array
    $elements = apply_filters('tarski_doctitle', $elements);
    // But if they don't, it won't try to implode
    if (is_array($elements)) {
        $doctitle = implode(' ', $elements);
    }
    echo $doctitle;
}
Пример #3
0
/**
 * Creates the document title.
 *
 * The order (site name first or last) can be set on the Tarski Options page.
 * While the function ultimately returns a string, please note that filters
 * are applied to an array! This allows plugins to easily alter any aspect
 * of the title. For example, one might write a plugin to change the separator.
 *
 * @since 1.5
 *
 * @param string $sep
 * @return string
 *
 * @hook filter tarski_doctitle
 * Filter document titles.
 */
function tarski_document_title($title, $sep, $seplocation)
{
    $title = trim($title);
    $sitename = get_bloginfo('name');
    $enc = get_option('blog_charset');
    if (!(isset($enc) && strlen($enc) > 0)) {
        $enc = "utf-8";
    }
    $slen = mb_strlen($sep, $enc);
    $tlen = mb_strlen($title, $enc);
    if ($seplocation == 'right') {
        $doctitle = mb_substr($title, 0, $tlen - $slen, $enc);
    } else {
        $doctitle = mb_substr($title, $slen, $tlen - $slen, $enc);
    }
    $doctitle = trim($doctitle);
    if (is_404()) {
        $doctitle = sprintf(__('Error %s', 'tarski'), '404');
    } elseif (get_option('show_on_front') == 'posts' && is_home()) {
        $doctitle = get_bloginfo('description', 'display');
    } elseif (is_search()) {
        $doctitle = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query()));
    } elseif (is_month()) {
        $doctitle = single_month_title(' ', false);
    } elseif (is_tag()) {
        $doctitle = multiple_tag_titles();
    }
    $title = array($sitename, $sep, $doctitle);
    if (get_tarski_option('swap_title_order')) {
        $title = array_reverse($title);
    }
    return implode(" ", $title);
}
Пример #4
0
        ?>
                </div>
            <?php 
    } elseif (is_tag()) {
        // Tag archive header
        ?>
                <div class="meta">
                    <h1 class="title"><?php 
        echo multiple_tag_titles();
        ?>
</h1>
                </div>
                
                <div class="content">
                    <p><?php 
        printf(__('You are currently browsing articles tagged %s.', 'tarski'), multiple_tag_titles('<strong>%s</strong>'));
        ?>
</p>
                </div>
            <?php 
    } elseif (is_author()) {
        // Author header
        ?>
                <div class="meta">
                    <h1 class="title"><?php 
        printf(__('Articles by %s', 'tarski'), the_archive_author_displayname());
        ?>
</h1>
                </div>
                
                <div class="content">