Пример #1
0
function get_main_title()
{
    if (is_archive()) {
        return apply_filters('ubik_archive_title', get_archive_title());
    }
    if (is_search()) {
        return apply_filters('ubik_search_title', get_search_title());
    }
    if (is_home()) {
        if ($page = get_option('page_for_posts', true)) {
            return get_the_title($page);
        }
        return esc_html__('Latest posts', 'ubik');
    }
    if (is_404()) {
        return esc_html__('Page not found', 'ubik');
    }
    // Note: this function should never reach this point
    if (is_singular()) {
        return single_post_title('', false);
    }
    return get_the_title();
}
Пример #2
0
/**
 * Returns the current page title.
 * @return string
 */
function get_page_title()
{
    if (is_home()) {
        if ($post_page = get_option('page_for_posts', true)) {
            return get_the_title($post_page);
        } else {
            return __('Latest Posts', 'roots');
        }
    } else {
        if (is_archive()) {
            return get_archive_title();
        } else {
            if (is_search()) {
                return sprintf(__('Search Results for %s', 'roots'), get_search_query());
            } else {
                if (is_404()) {
                    return __('Not Found', 'roots');
                }
            }
        }
    }
    return get_the_title();
}