本文整理汇总了PHP中single_cat_title函数的典型用法代码示例。如果您正苦于以下问题:PHP single_cat_title函数的具体用法?PHP single_cat_title怎么用?PHP single_cat_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了single_cat_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: 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');
}
}
示例3: 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";
}
示例4: 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>';
}
示例5: boilerplate_title
/**
* Handle output of page title
*/
function boilerplate_title($post = null)
{
$queried_object = get_queried_object();
if (is_home()) {
if (get_option('page_for_posts', true)) {
return get_the_title(get_option('page_for_posts', true));
} else {
return __('Latest Posts', 'boilerplate');
}
} elseif (is_archive()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term && get_query_var('taxonomy') !== 'language') {
return apply_filters('single_term_title', $term->name);
} elseif (is_post_type_archive()) {
return apply_filters('the_title', @$queried_object->labels->name ?: $queried_object->post_title);
} elseif (is_day()) {
return sprintf(__('Daily Archives: %s', 'boilerplate'), get_the_date());
} elseif (is_month()) {
return sprintf(__('Monthly Archives: %s', 'boilerplate'), get_the_date('F Y'));
} elseif (is_year()) {
return sprintf(__('Yearly Archives: %s', 'boilerplate'), get_the_date('Y'));
} elseif (is_author()) {
$author = $queried_object;
return sprintf(__('Author Archives: %s', 'boilerplate'), apply_filters('the_author', is_object($author) ? $author->display_name : null));
} else {
return single_cat_title('', false);
}
} elseif (is_search()) {
return sprintf(__('Search Results for “%s”', 'boilerplate'), get_search_query());
} elseif (is_404()) {
return __('Not Found', 'boilerplate');
} else {
return get_the_title();
}
}
示例6: smarty_single_cat_title
function smarty_single_cat_title($params)
{
$display = '';
$prefix = '';
extract($params);
return single_cat_title($prefix, $display);
}
示例7: dw_timeline_title
/**
* Page titles
*/
function dw_timeline_title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
return get_the_title(get_option('page_for_posts', true));
} else {
return get_bloginfo('name');
}
} elseif (is_archive()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term) {
return apply_filters('single_term_title', $term->name);
} elseif (is_post_type_archive()) {
return apply_filters('the_title', get_queried_object()->labels->name);
} elseif (is_day()) {
return sprintf(__('Daily Archives: %s', 'dw-timeline'), get_the_date());
} elseif (is_month()) {
return sprintf(__('Monthly Archives: %s', 'dw-timeline'), get_the_date('F Y'));
} elseif (is_year()) {
return sprintf(__('Yearly Archives: %s', 'dw-timeline'), get_the_date('Y'));
} elseif (is_author()) {
$author = get_queried_object();
return sprintf(__('Author Archives: %s', 'dw-timeline'), $author->display_name);
} else {
return single_cat_title('', false);
}
} elseif (is_search()) {
return sprintf(__('Search Results for %s', 'dw-timeline'), get_search_query());
} elseif (is_404()) {
return __('Not Found', 'dw-timeline');
} else {
return get_the_title();
}
}
示例8: 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();
}
}
示例9: 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');
}
示例10: reactor_category_submenu
function reactor_category_submenu($args = '')
{
$defaults = array('taxonomy' => 'category', 'all_link' => __('All', 'reactor'), 'quicksand' => false, 'terms_args' => '');
$args = wp_parse_args($args, $defaults);
$count = 0;
$terms = get_terms($args['taxonomy'], $args['terms_args']) ? get_terms($args['taxonomy'], $args['terms_args']) : '';
$count = count($terms);
if ($count > 1) {
$filter_class = $args['quicksand'] ? ' filter-nav' : '';
$output = '<div class="category-submenu"><dl class="sub-nav' . $filter_class . '"><dt>' . __('Categories: ', 'reactor') . '</dt>';
if ($args['quicksand']) {
$output .= '<div class="category-submenu"><dd class="filter active" data-filter="all"><a>' . $args['all_link'] . '</a></dd>';
}
$current_category = single_cat_title('', false);
$i = 2;
foreach ($terms as $term) {
$active = $term->name == $current_category ? 'active' : '';
if ($args['quicksand']) {
$output .= '<dd class="filter" data-filter="' . $term->slug . '"><a>' . $term->name . '</a></dd>';
} else {
$output .= '<dd class="' . $active . '"><a href="' . get_term_link($term->slug, $args['taxonomy']) . '">' . $term->name . '</a></dd>';
}
$i++;
}
$output .= '</dl></div>';
echo apply_filters('reactor_category_submenu', $output, $args);
}
}
示例11: roots_title
/**
* Page titles
*/
function roots_title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
return get_the_title(get_option('page_for_posts', true));
} else {
return __('Latest Posts', 'roots');
}
} elseif (is_archive()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term) {
return apply_filters('single_term_title', $term->name);
} elseif (is_post_type_archive()) {
return apply_filters('the_title', get_queried_object()->labels->name);
} elseif (is_day()) {
return sprintf(__('<span>Daily Archives:</span> %s', 'roots'), get_the_date());
} elseif (is_month()) {
return sprintf(__('<span>Monthly Archives:</span> %s', 'roots'), get_the_date('F Y'));
} elseif (is_year()) {
return sprintf(__('<span>Yearly Archives:</span> %s', 'roots'), get_the_date('Y'));
} elseif (is_author()) {
$author = get_queried_object();
return sprintf(__('<span>Author Archives:</span> %s', 'roots'), $author->display_name);
} else {
return single_cat_title('', false);
}
} elseif (is_search()) {
return sprintf(__('<span>Search Results for</span> "%s"', 'roots'), get_search_query());
} elseif (is_404()) {
return __('Not Found', 'roots');
} else {
return get_the_title();
}
}
示例12: 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
}
示例13: ungarh_title
/**
* Page titles
*/
function ungarh_title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
return get_the_title(get_option('page_for_posts', true));
} else {
return __('Senaste inläggen', 'ungarh');
}
} elseif (is_archive()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term) {
return apply_filters('single_term_title', $term->name);
} elseif (is_post_type_archive()) {
return apply_filters('the_title', get_queried_object()->labels->name);
} elseif (is_day()) {
return sprintf(__('Dagligt Arkiv: %s', 'ungarh'), get_the_date());
} elseif (is_month()) {
return sprintf(__('Arkiv för månad: %s', 'ungarh'), get_the_date('F Y'));
} elseif (is_year()) {
return sprintf(__('Årligt arkiv: %s', 'ungarh'), get_the_date('Y'));
} elseif (is_author()) {
$author = get_queried_object();
return sprintf(__('Arkiv för personer: %s', 'ungarh'), apply_filters('the_author', is_object($author) ? $author->display_name : null));
} else {
return single_cat_title('', false);
}
} elseif (is_search()) {
return sprintf(__('Sökresultat för: %s', 'ungarh'), get_search_query());
} elseif (is_404()) {
return __('Sidan finns inte', 'ungarh');
} else {
return get_the_title();
}
}
示例14: 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);
}
示例15: ya_title
/**
* Page titles
*/
function ya_title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
echo get_the_title(get_option('page_for_posts', true));
} else {
_e('Latest Posts', 'yatheme');
}
} elseif (is_archive()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if ($term) {
echo $term->name;
} elseif (is_post_type_archive()) {
echo get_queried_object()->labels->name;
} elseif (is_day()) {
printf(__('Daily Archives: %s', 'yatheme'), get_the_date());
} elseif (is_month()) {
printf(__('Monthly Archives: %s', 'yatheme'), get_the_date('F Y'));
} elseif (is_year()) {
printf(__('Yearly Archives: %s', 'yatheme'), get_the_date('Y'));
} elseif (is_author()) {
printf(__('Author Archives: %s', 'yatheme'), get_the_author());
} else {
single_cat_title();
}
} elseif (is_search()) {
printf(__('Search Results for <small>%s</small>', 'yatheme'), get_search_query());
} elseif (is_404()) {
_e('Not Found', 'yatheme');
} else {
the_title();
}
}