本文整理汇总了PHP中single_tag_title函数的典型用法代码示例。如果您正苦于以下问题:PHP single_tag_title函数的具体用法?PHP single_tag_title怎么用?PHP single_tag_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了single_tag_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: presscore_search_title_shortcode
function presscore_search_title_shortcode()
{
$title = '';
$wrap_class = '';
if (is_search()) {
$title = get_search_query();
} else {
if (is_archive()) {
if (is_category()) {
$title = single_cat_title('', false);
} elseif (is_tag()) {
$title = single_tag_title('', false);
} elseif (is_author()) {
the_post();
$title = '<a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta("ID"))) . '" title="' . esc_attr(get_the_author()) . '" rel="me">' . get_the_author() . '</a>';
$wrap_class .= ' vcard';
rewind_posts();
} elseif (is_day()) {
$title = '<span>' . get_the_date() . '</span>';
} elseif (is_month()) {
$title = '<span>' . get_the_date('F Y');
} elseif (is_year()) {
$title = '<span>' . get_the_date('Y');
} elseif (is_tax('dt_portfolio_category')) {
$title = single_term_title('', false);
} elseif (is_tax('dt_gallery_category')) {
$title = single_term_title('', false);
}
}
}
if ($title) {
$title = '<span' . ($wrap_class ? ' class="' . esc_attr($wrap_class) . '"' : '') . '>' . $title . '</span>';
}
return $title;
}
示例2: theme_description
function theme_description()
{
global $s, $post;
$description = '';
$blog_name = get_bloginfo('name');
if (is_singular()) {
if (!empty($post->post_excerpt)) {
$text = $post->post_excerpt;
} else {
$text = $post->post_content;
}
$description = trim(str_replace(array("\r\n", "\r", "\n", " ", " "), " ", str_replace("\"", "'", strip_tags($text))));
if (!$description) {
$description = $blog_name . "-" . trim(wp_title('', false));
}
} elseif (is_home()) {
$description = $blog_name . "-" . get_bloginfo('description') . '|' . dopt('Rcloud_description');
// 首頁要自己加
} elseif (is_tag()) {
$description = $blog_name . "有关 '" . single_tag_title('', false) . "' 的文章";
} elseif (is_category()) {
$description = $blog_name . "有关 '" . single_cat_title('', false) . "' 的文章";
} elseif (is_archive()) {
$description = $blog_name . "在: '" . trim(wp_title('', false)) . "' 的文章";
} elseif (is_search()) {
$description = $blog_name . ": '" . esc_html($s, 1) . "' 的搜索結果";
} else {
$description = $blog_name . "有关 '" . trim(wp_title('', false)) . "' 的文章";
}
$description = mb_substr($description, 0, 220, 'utf-8') . '..';
echo "<meta name=\"description\" content=\"{$description}\" />\n";
}
示例3: title
function title()
{
if (is_category()) {
echo 'Category Archive for "';
single_cat_title();
echo '" | ';
bloginfo('name');
} elseif (is_tag()) {
echo 'Tag Archive for "';
single_tag_title();
echo '" | ';
bloginfo('name');
} elseif (is_archive()) {
wp_title('');
echo ' Archive | ';
bloginfo('name');
} elseif (is_search()) {
echo 'Search for "' . wp_specialchars($s) . '" | ';
bloginfo('name');
} elseif (is_home() || is_front_page()) {
bloginfo('name');
echo ' | ';
bloginfo('description');
} elseif (is_404()) {
echo 'Error 404 Not Found | ';
bloginfo('name');
} elseif (is_single()) {
wp_title('');
} else {
echo wp_title(' | ', false, right);
bloginfo('name');
}
}
示例4: OnPrePageLoad
function OnPrePageLoad()
{
# set page title
if (have_posts()) {
$post = $posts[0];
// Hack. Set $post so that the_date() works.
/* If this is a category archive */
if (is_category()) {
$this->title = single_cat_title('', false);
$this->SetPageTitle($this->title);
} elseif (is_tag()) {
$this->title = " tagged with '" . single_tag_title('', false) . "'";
$this->SetPageTitle('Stoolball news ' . $this->title);
} elseif (is_day()) {
$this->title = "on " . apply_filters('the_time', get_the_time('j F Y'), 'j F Y');
$this->SetPageTitle('Stoolball news ' . $this->title);
} elseif (is_month()) {
$this->title = 'in ' . apply_filters('the_time', get_the_time('F Y'), 'F Y');
$this->SetPageTitle('Stoolball news ' . $this->title);
} elseif (is_year()) {
$this->title = 'in ' . apply_filters('the_time', get_the_time('Y'), 'Y');
$this->SetPageTitle('Stoolball news ' . $this->title);
} elseif (is_author()) {
$this->title = "by author";
$this->SetPageTitle('Stoolball news ' . $this->title);
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
$this->SetPageTitle('Stoolball news');
}
}
$this->SetOpenGraphType("blog");
$this->SetContentConstraint($this->ConstrainColumns());
$this->SetContentCssClass('hasLargeImage');
}
示例5: title
function title()
{
global $thesis_site, $thesis_pages;
$site_name = get_bloginfo('name');
#wp
$separator = $thesis_site->head['title']['separator'] ? urldecode($thesis_site->head['title']['separator']) : '—';
if (is_home() || is_front_page()) {
#wp
$tagline = get_bloginfo('description');
#wp
$home_title = $thesis_pages->home['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->home['head']['title']))) : "{$site_name} {$separator} {$tagline}";
#wp
if (get_option('show_on_front') == 'page' && is_front_page()) {
#wp
$page_title = get_post_meta(get_option('page_on_front'), 'thesis_title', true);
} elseif (get_option('show_on_front') == 'page' && is_home()) {
#wp
$page_title = get_post_meta(get_option('page_for_posts'), 'thesis_title', true);
}
#wp
$output = $page_title ? trim(wptexturize(strip_tags(stripslashes($page_title)))) : $home_title;
#wp
} elseif (is_category()) {
#wp
global $wp_query;
#wp
$category_title = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title']))) : single_cat_title('', false);
#wp
$output = $thesis_site->head['title']['branded'] ? "{$category_title} {$separator} {$site_name}" : $category_title;
} elseif (is_tag()) {
global $wp_query;
#wp
$tag_title = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title']))) : single_tag_title('', false);
#wp
$output = $thesis_site->head['title']['branded'] ? "{$tag_title} {$separator} {$site_name}" : $tag_title;
} elseif (is_search()) {
#wp
$search_title = __('You searched for', 'thesis') . ' “' . attribute_escape(get_search_query()) . '”';
#wp
$output = $thesis_site->head['title']['branded'] ? "{$search_title} {$separator} {$site_name}" : $search_title;
} else {
global $post;
#wp
$custom_title = is_single() || is_page() ? trim(wptexturize(strip_tags(stripslashes(get_post_meta($post->ID, 'thesis_title', true))))) : false;
#wp
$page_title = $custom_title ? $custom_title : trim(wp_title('', false));
#wp
$output = $thesis_site->head['title']['branded'] ? "{$page_title} {$separator} {$site_name}" : $page_title;
}
if (is_home() || is_archive() || is_search()) {
#wp
$current_page = get_query_var('paged');
#wp
if ($current_page > 1) {
$output .= " {$separator} " . __('Page', 'thesis') . " {$current_page}";
}
}
$this->title['title'] = '<title>' . apply_filters('thesis_title', $output, $separator) . '</title>';
#wp #filter
}
示例6: or_page_title
function or_page_title()
{
$post = $posts[0];
// Hack. Set $post so that the_date() works.
/* If this is a category archive */
if (is_category()) {
$title = '<h3 class="pagetitle">' . __('Archive for the ‘') . single_cat_title("", false) . __('’ Category') . '</h3>';
/* If this is a tag archive */
} elseif (is_tag()) {
$title = '<h3 class="pagetitle">' . __('Posts Tagged ‘') . single_tag_title("", false) . __('’') . '</h3>';
/* If this is a daily archive */
} elseif (is_day()) {
$title = '<h3 class="pagetitle">' . __('Archive for ') . get_the_time('F jS, Y') . '</h3>';
/* If this is a monthly archive */
} elseif (is_month()) {
$title = '<h3 class="pagetitle">' . __('Archive for ') . get_the_time('F, Y') . '</h3>';
/* If this is a yearly archive */
} elseif (is_year()) {
$title = '<h3 class="pagetitle">' . __('Archive for ') . get_the_time('Y') . '</h3>';
/* If this is an author archive */
} elseif (is_author()) {
$title = '<h3 class="pagetitle">' . __('Author Archive') . '</h3>';
/* If this is a paged archive */
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
$title = '<h3 class="pagetitle">' . __('Blog Archives') . '</h3>';
} elseif (is_search()) {
$title = '<h3>' . __('Search Results for "') . get_search_query() . __('"') . '</h3>';
}
echo apply_filters('or_page_title', $title);
}
示例7: crumb
function crumb()
{
if (is_attachment()) {
$titles = $title = '附件';
} elseif (is_single()) {
$categorys = get_the_category();
$category = $categorys[0];
$title = get_the_title();
$titles = get_category_parents($category->term_id, true, ' » ') . $title;
} elseif (is_page()) {
$titles = $title = get_the_title();
} elseif (is_category()) {
$titles = $title = single_cat_title('', false);
} elseif (is_tag()) {
$titles = $title = single_tag_title('', false);
} elseif (is_day()) {
$titles = $title = get_the_time('Y年Fj日');
} elseif (is_month()) {
$titles = $title = get_the_time('Y年F');
} elseif (is_year()) {
$titles = $title = get_the_time('Y年');
} elseif (is_search()) {
global $s;
$titles = $title = $s . ' 的搜索结果';
} else {
$titles = $title = '';
}
echo '<div class="crumb">' . ' <strong style="display:inline;">' . $title . '</strong>' . ' <div class="nav_crumb">' . ' <a href="' . get_bloginfo('url') . '" title="' . get_bloginfo('name') . '">HOME</a> » ' . $titles . ' </div>' . '</div>';
}
示例8: sociallyviral_archive_title
/**
* Shim for `sociallyviral_archive_title()`.
*
* Display the archive title based on the queried object.
*
* @todo Remove this function when WordPress 4.3 is released.
*
* @param string $before Optional. Content to prepend to the title. Default empty.
* @param string $after Optional. Content to append to the title. Default empty.
*/
function sociallyviral_archive_title($before = '', $after = '')
{
if (is_category()) {
$title = sprintf(__('Category: %s', 'sociallyviral'), single_cat_title('', false));
} elseif (is_tag()) {
$title = sprintf(__('Tag: %s', 'sociallyviral'), single_tag_title('', false));
} elseif (is_author()) {
$title = sprintf(__('Author: %s', 'sociallyviral'), '<span class="vcard">' . get_the_author() . '</span>');
} elseif (is_year()) {
$title = sprintf(__('Year: %s', 'sociallyviral'), get_the_date(_x('Y', 'yearly archives date format', 'sociallyviral')));
} elseif (is_month()) {
$title = sprintf(__('Month: %s', 'sociallyviral'), get_the_date(_x('F Y', 'monthly archives date format', 'sociallyviral')));
} elseif (is_day()) {
$title = sprintf(__('Day: %s', 'sociallyviral'), get_the_date(_x('F j, Y', 'daily archives date format', 'sociallyviral')));
} elseif (is_post_type_archive()) {
$title = sprintf(__('Archives: %s', 'sociallyviral'), post_type_archive_title('', false));
} elseif (is_tax()) {
$tax = get_taxonomy(get_queried_object()->taxonomy);
/* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
$title = sprintf(__('%1$s: %2$s', 'sociallyviral'), $tax->labels->singular_name, single_term_title('', false));
} else {
$title = __('Archives', 'sociallyviral');
}
/**
* Filter the archive title.
*
* @param string $title Archive title to be displayed.
*/
$title = apply_filters('get_the_archive_title', $title);
if (!empty($title)) {
echo $before . $title . $after;
}
}
示例9: wolf_breadcrumbs_get_category_links
function wolf_breadcrumbs_get_category_links($page_id = '')
{
if (strlen(trim($page_id)) > 0) {
$cat_name = '';
$cat_url = '';
$cats = get_the_category($page_id);
if (count($cats) > 0) {
$cat = $cats[0];
$cat_id = $cat->cat_ID;
$cat_name = $cat->cat_name;
$cat_url = get_category_link($cat_id);
}
} else {
if (single_tag_title('', false == '')) {
$cat_id = get_query_var('cat');
$cat_name = get_cat_name($cat_id);
$cat_url = get_category_link($cat_id);
} else {
$cat_url = get_tag_link(get_query_var('tag_id'));
$cat_name = single_tag_title('', false);
}
}
$cat_link = '<li>';
$cat_link .= '<a href="' . $cat_url . '" itemprop="url"><span itemprop="title">' . $cat_name . '</span></a>';
if (strlen(trim($page_id)) > 0 && strlen(trim($cat_name)) > 0) {
$cat_link .= '<span class="divider">/</span>';
}
$cat_link .= '</li>';
return $cat_link;
}
示例10: perfect_title
/**
* Prints better page title
*/
function perfect_title()
{
echo '<title>';
if (function_exists('is_tag') && is_tag()) {
single_tag_title(__('Tag Archive for') . '"');
$output .= '" - ';
} elseif (is_archive()) {
wp_title('');
echo __('Archive') . ' - ';
} elseif (is_search()) {
echo __('Search for') . '"' . esc_html($s) . '" - ';
} elseif (!is_404() && is_single() || is_page()) {
wp_title('');
echo ' - ';
} elseif (is_404()) {
echo __('Not Found') . '-';
}
if (is_home()) {
bloginfo('name');
echo ' - ';
bloginfo('description');
} else {
bloginfo('name');
}
if ($paged > 1) {
echo ' - ' . __('page') . ' ' . $paged;
}
echo '</title>';
}
示例11: mh_page_title
function mh_page_title()
{
if (is_home()) {
echo get_the_title(get_option('page_for_posts', true));
} elseif (is_author()) {
global $author;
$user_info = get_userdata($author);
echo __('Articles by ', 'mh') . esc_attr($user_info->display_name);
} elseif (is_category() || is_tax()) {
echo single_cat_title("", false);
} elseif (is_tag()) {
echo single_tag_title("", false);
} elseif (is_search()) {
echo __('Search Results for ', 'mh') . get_search_query();
} elseif (is_day()) {
echo get_the_date();
} elseif (is_month()) {
echo get_the_date('F Y');
} elseif (is_year()) {
echo get_the_date('Y');
} elseif (is_404()) {
echo __('Page not found (404)', 'mh');
} else {
echo get_the_title();
}
}
示例12: warrior_archive_title
function warrior_archive_title()
{
global $wp_query;
$title = '';
if (is_category()) {
$title = sprintf(__('%s <span>Category Archives</span>', 'familia'), single_cat_title('', false));
} elseif (is_tag()) {
$title = sprintf(__('%s <span>Tag Archives</span>', 'familia'), single_tag_title('', false));
} elseif (get_post_format()) {
$title = sprintf(__('Post Format: %s', 'familia'), get_post_format_string(get_post_format()));
} elseif (is_day()) {
$title = sprintf(__('%s <span>Daily Archives</span>', 'familia'), date_i18n('d', strtotime(get_the_date('Y-m-d'), false)));
} elseif (is_month()) {
$title = sprintf(__('%s <span>Monthly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false)));
} elseif (is_year()) {
$title = sprintf(__('%s <span>Yearly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false)));
} elseif (is_author()) {
$author = get_user_by('slug', get_query_var('author_name'));
$title = sprintf(__('%s <span>Author Archives</span>', 'familia'), get_the_author_meta('display_name', $author->ID));
} elseif (is_search()) {
if ($wp_query->found_posts) {
$title = sprintf(__('Search Results for: "%s"', 'familia'), esc_attr(get_search_query()));
} else {
$title = sprintf(__('No Results for: "%s"', 'familia'), esc_attr(get_search_query()));
}
} elseif (is_404()) {
$title = __('Not Found', 'familia');
} elseif (is_home() || is_front_page() || is_single()) {
$title = '';
} else {
$title = __('Blog', 'familia');
}
return $title;
}
示例13: bavota_breadcrumbs
function bavota_breadcrumbs()
{
if (!is_front_page()) {
echo '<a href="' . home_url('/') . 'blog">Blog</a><span class="divider"> <i class="icon-angle-right"></i> </span>';
}
if (is_category() || is_single()) {
$category = get_the_category();
$ID = $category[0]->cat_ID;
// echo get_category_parents($ID, TRUE, ' ', FALSE ); // was causing errors in the error_log
echo is_wp_error($cat_parents = get_category_parents($ID, TRUE, ' ', FALSE)) ? '' : $cat_parents;
}
$mytitle = get_the_title();
if (strlen($mytitle) > 22) {
$mytitle = substr($mytitle, 0, 38) . "...";
}
if (is_single() || is_page()) {
echo ' <span class="divider"> <i class="icon-angle-right"></i> </span> ';
echo $mytitle;
}
if (is_tag()) {
echo "Tag: " . single_tag_title('', FALSE);
}
if (is_404()) {
echo "404 - Page not Found";
}
if (is_search()) {
echo "Search";
}
if (is_year()) {
echo get_the_time('Y');
}
}
示例14: ubik_title_archives
function ubik_title_archives()
{
if (is_category()) {
$title = sprintf(__('%s archives', 'ubik'), single_cat_title('', false));
} elseif (is_tag()) {
$title = sprintf(__('%s archives', 'ubik'), single_tag_title('', false));
} elseif (is_tax()) {
$title = sprintf(__('%s archives', 'ubik'), single_term_title('', false));
} elseif (is_post_type_archive()) {
$title = sprintf(__('%s archives', 'ubik'), post_type_archive_title('', false));
} elseif (is_author()) {
$title = sprintf(__('Posts by %s', 'ubik'), get_the_author_meta('display_name', get_query_var('author')));
} elseif (is_date()) {
if (get_query_var('second') || get_query_var('minute') || get_query_var('hour')) {
$title = sprintf(__('%s archives', 'ubik'), get_the_time(__('g:i a', 'ubik')));
} elseif (is_day()) {
$title = sprintf(__('%s daily archives', 'ubik'), get_the_date(_x('F j, Y', 'daily archives date format', 'ubik')));
} elseif (get_query_var('w')) {
$title = sprintf(__('Week %1$s of %2$s archives', 'ubik'), get_the_time(__('W', 'ubik')), get_the_time(__('Y', 'ubik')));
} elseif (is_month()) {
$title = sprintf(__('%s monthly archives', 'ubik'), get_the_date(_x('F Y', 'monthly archives date format', 'ubik')));
} elseif (is_year()) {
$title = sprintf(__('%s yearly archives', 'ubik'), get_the_date(_x('Y', 'yearly archives date format', 'ubik')));
} else {
$title = get_the_date();
}
} else {
$title = __('Archives', 'ubik');
}
return apply_filters('ubik_title_archives', $title);
}
示例15: d7_get_page_title
/**
* Page title used in the content area of each page. Note this is kinda legacy.
* Could be replaced with wp_title().
*
* @package d7
* @subpackage boilerplate-theme
*
* @return string The page title
*
*/
function d7_get_page_title()
{
$title = '';
if (is_category()) {
$title .= single_cat_title("", false);
} elseif (is_tag()) {
$title .= __('Content tagged: ', get_bloginfo('name')) . single_tag_title("", false);
} elseif (is_day()) {
$title .= __('Archive for ', get_bloginfo('name')) . get_the_time('F jS, Y');
} elseif (is_month()) {
$title .= __('Archive for', get_bloginfo('name')) . ' ' . get_the_time('F, Y');
} elseif (is_year()) {
$title .= __('Archive for', get_bloginfo('name')) . ' ' . get_the_time('Y');
} elseif (is_search()) {
$title .= __('Search results', get_bloginfo('name'));
if (isset($_GET['s'])) {
$title .= ' ' . __('for', get_bloginfo('name')) . ' <span class="search_term">"' . $_GET['s'] . '"</span>';
}
} elseif (is_author()) {
$title .= __('Author archive', get_bloginfo('name'));
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
$title .= __('Archives');
} elseif (is_404()) {
$title .= __('Oh darn!', get_bloginfo('name'));
} else {
$title .= bloginfo('name');
}
return $title;
}