本文整理汇总了PHP中single_term_title函数的典型用法代码示例。如果您正苦于以下问题:PHP single_term_title函数的具体用法?PHP single_term_title怎么用?PHP single_term_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了single_term_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: tb_archive_title
/**
* Gets The Archive Title Set In The Options, With Normal Defaults.
*
* Pass true to echo instead or returning the value
*
* @param bool $echo
* @return mixed|null|string|void
* @since 0.1
*/
function tb_archive_title($echo = true)
{
$out = __('Archive');
if (is_tax('tb_genre')) {
$opt = get_option('genre_archive_title');
$out = $opt ? $opt : single_term_title('', false);
}
if (is_tax('tb_author')) {
$opt = get_option('author_archive_title');
$out = $opt ? $opt : single_term_title('', false);
}
if (is_tax('tb_series')) {
$opt = get_option('series_archive_title');
$out = $opt ? $opt : single_term_title('', false);
}
if (is_post_type_archive('tb_book')) {
$opt = get_option('book_archive_title');
$out = $opt ? $opt : __('Books Archives', 'totally-booked');
}
if (!$echo) {
return $out;
}
echo $out;
return;
}
示例3: get_index_headline
function get_index_headline()
{
if (is_home()) {
$index_headline = 'Blog Index';
} else {
if (is_category()) {
$category = single_term_title("", false);
$index_headline = 'Archives for the "' . $category . '" Category';
} elseif (is_tag()) {
$tag = single_term_title("", false);
$index_headline = 'Archives for the "' . $tag . '" Category';
} elseif (is_day()) {
$index_headline = 'Archive for ' . get_the_time('F jS, Y');
} elseif (is_month()) {
$index_headline = 'Archive for ' . get_the_time('F Y');
} elseif (is_year()) {
$index_headline = 'Archive for ' . get_the_time('Y');
} elseif (is_author()) {
$index_headline = 'Author Archive';
} else {
$index_headline = 'Blog Archives';
}
}
return $index_headline;
}
示例4: wpex_page_title
function wpex_page_title($title = '')
{
global $post;
// Homepage - display blog description if not a static page
if (is_front_page() && !is_singular('page')) {
$title = get_bloginfo('description');
// Archives
} elseif (is_archive()) {
// Daily archive title
if (is_day()) {
$title = sprintf(__('Daily Archives: %s', 'wpex'), get_the_date());
// Monthly archive title
} elseif (is_month()) {
$title = sprintf(__('Monthly Archives: %s', 'wpex'), get_the_date(_x('F Y', 'monthly archives date format', 'wpex')));
// Yearly archive title
} elseif (is_year()) {
$title = sprintf(__('Yearly Archives: %s', 'wpex'), get_the_date(_x('Y', 'yearly archives date format', 'wpex')));
// Standard term title
} else {
$title = single_term_title('', false);
}
// Search
} elseif (is_search()) {
global $wp_query;
$title = '<span id="search-results-count">' . $wp_query->found_posts . '</span> ' . __('Search Results Found', 'wpex');
// 404 Page
} elseif (is_404()) {
$title = __("404: Page Not Found", "wpex");
// All else
} else {
$post_id = $post->ID;
$title = get_the_title($post_id);
}
return $title;
}
示例5: featureText
function featureText()
{
if (is_front_page()) {
the_field('feature_text');
} elseif (is_home() || is_single()) {
_e('Rock Theme Official Blog');
} elseif (is_archive()) {
_e('Rock Theme Official Blog');
_e('<br>');
single_term_title('Browsing: ');
if (is_month()) {
$monthNum = get_query_var('monthnum');
$month = date('F', mktime(0, 0, 0, $monthNum));
$year = get_query_var('year');
echo 'Posts from ' . $month . ' ' . $year;
}
} elseif (is_page_template('page-news.php') || is_page_template('page-about.php') || is_page_template('page-contact.php')) {
bloginfo('name');
_e('<br>');
the_title();
} elseif (is_404()) {
_e('Whoops, were a little lost.');
} elseif (is_search()) {
_e('Rock Theme Official Blog');
_e('<br>');
printf('Search results for: %s', get_search_query());
}
}
示例6: filter_page_title
public function filter_page_title($page_title)
{
if (is_tax('dt_portfolio_category')) {
$page_title = sprintf(__('Portfolio Archives: %s', 'the7mk2'), '<span>' . single_term_title('', false) . '</span>');
}
return $page_title;
}
示例7: 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);
}
示例8: dobalance_bbs
function dobalance_bbs()
{
global $wpdb;
$label_bbs = '게시판';
//__('BBS',DOBslug)
$label_open = '열기';
//__('Open',DOBslug)
$label_close = '닫기';
//__('Close',DOBslug)
$bbs = '';
$title = single_term_title('', false);
//get_the_archive_title();
$id = $wpdb->get_var($wpdb->prepare("SELECT uid FROM {$wpdb->prefix}kboard_board_setting WHERE board_name=%s", $title));
if (!empty($id)) {
$bbs = kboard_builder(['id' => $id]);
}
if (empty($bbs)) {
return;
}
echo <<<HTML
<!--div class="panel-group"-->
<div class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-target="#dobalance_bbs">
<span class="panel-title">{$label_bbs}</span>
</div>
<div id="dobalance_bbs" class="panel-collapse collapse in">
{$bbs}
</div>
</div>
<!--/div-->
HTML;
}
示例9: kopa_shortcode_term_name
/**
*
*
* @package Kopa
* @subpackage Core
* @author thethangtran <tranthethang@gmail.com>
* @since 1.0.0
*
*/
function kopa_shortcode_term_name($atts, $content = null)
{
$term_name = '';
if (is_tag() || is_category()) {
$term_name = single_term_title('', false);
}
return apply_filters('kopa_shortcode_term_name', $term_name);
}
示例10: viewed_category
/**
* Adds category name to analytics.page()
*
* @since 1.0.0
* @access public
*
* @uses func_get_args() Because our abstract class doesn't know how many parameters are passed to each hook
* for each different platform, we use func_get_args().
*
* @return array Filtered array of name and properties for analytics.page().
*/
public function viewed_category()
{
$args = func_get_args();
$page = $args[0];
if (is_tax('product_cat')) {
$page = array('page' => single_term_title('', false), 'properties' => array());
}
return $page;
}
示例11: Bing_archive_header
/**
*存档页信息
*http://www.bgbk.org
*/
function Bing_archive_header()
{
if (!is_archive()) {
return;
}
if (is_author()) {
$dashicons = 'admin-users';
$name = $GLOBALS['authordata']->display_name;
$description = get_the_author_meta('description');
$feed_link = get_author_feed_link($GLOBALS['authordata']->ID);
} elseif (is_date()) {
$dashicons = 'calendar';
if (is_day()) {
$format = __('Y年m月d日', 'Bing');
} elseif (is_month()) {
$format = __('Y年m月', 'Bing');
} else {
$format = __('Y年', 'Bing');
}
$name = get_the_date($format);
$description = sprintf(__('%s发布的文章', 'Bing'), $name);
} else {
$dashicons = is_tag() ? 'tag' : 'category';
$name = single_term_title('', false);
$description = term_description();
$feed_link = get_term_feed_link(get_queried_object_id(), get_queried_object()->taxonomy);
}
$description = strip_tags($description);
?>
<div class="span12 archive-header">
<article class="panel">
<header class="panel-header">
<h3>
<span class="dashicons dashicons-<?php
echo $dashicons;
?>
"></span><?php
echo $name;
?>
</h3>
<?php
if (Bing_mpanel('breadcrumbs')) {
Bing_breadcrumbs('<span class="separator dashicons dashicons-arrow-right-alt2"></span>', '<span class="right breadcrumb"%s>', '</span>', '<span class="dashicons dashicons-admin-home"></span>' . __('首页', 'Bing'));
}
?>
</header>
<?php
echo empty($description) ? __('无描述', 'Bing') : $description;
if (!empty($feed_link)) {
printf('<a href="%s" title="%s" class="feed-link"><span class="dashicons dashicons-rss"></span></a>', esc_url($feed_link), esc_attr(__('此存档的 Feed 源,可以使用 RSS 阅读器订阅这些内容', 'Bing')));
}
?>
</article>
</div>
<?php
}
示例12: illdy_archive_title
function illdy_archive_title($before = '', $after = '')
{
if (is_category()) {
$title = sprintf(esc_html__('Category: %s', 'illdy'), single_cat_title('', false));
} elseif (is_tag()) {
$title = sprintf(esc_html__('Tag: %s', 'illdy'), single_tag_title('', false));
} elseif (is_author()) {
$title = sprintf(esc_html__('Author: %s', 'illdy'), '<span class="vcard">' . get_the_author() . '</span>');
} elseif (is_year()) {
$title = sprintf(esc_html__('Year: %s', 'illdy'), get_the_date(esc_html_x('Y', 'yearly archives date format', 'illdy')));
} elseif (is_month()) {
$title = sprintf(esc_html__('Month: %s', 'illdy'), get_the_date(esc_html_x('F Y', 'monthly archives date format', 'illdy')));
} elseif (is_day()) {
$title = sprintf(esc_html__('Day: %s', 'illdy'), get_the_date(esc_html_x('F j, Y', 'daily archives date format', 'illdy')));
} elseif (is_tax('post_format')) {
if (is_tax('post_format', 'post-format-aside')) {
$title = esc_html_x('Asides', 'post format archive title', 'illdy');
} elseif (is_tax('post_format', 'post-format-gallery')) {
$title = esc_html_x('Galleries', 'post format archive title', 'illdy');
} elseif (is_tax('post_format', 'post-format-image')) {
$title = esc_html_x('Images', 'post format archive title', 'illdy');
} elseif (is_tax('post_format', 'post-format-video')) {
$title = esc_html_x('Videos', 'post format archive title', 'illdy');
} elseif (is_tax('post_format', 'post-format-quote')) {
$title = esc_html_x('Quotes', 'post format archive title', 'illdy');
} elseif (is_tax('post_format', 'post-format-link')) {
$title = esc_html_x('Links', 'post format archive title', 'illdy');
} elseif (is_tax('post_format', 'post-format-status')) {
$title = esc_html_x('Statuses', 'post format archive title', 'illdy');
} elseif (is_tax('post_format', 'post-format-audio')) {
$title = esc_html_x('Audio', 'post format archive title', 'illdy');
} elseif (is_tax('post_format', 'post-format-chat')) {
$title = esc_html_x('Chats', 'post format archive title', 'illdy');
}
} elseif (is_post_type_archive()) {
$title = sprintf(esc_html__('Archives: %s', 'illdy'), 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(esc_html__('%1$s: %2$s', 'illdy'), $tax->labels->singular_name, single_term_title('', false));
} else {
$title = esc_html__('Archives', 'illdy');
}
/**
* 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;
// WPCS: XSS OK.
}
}
示例13: term_slug
function term_slug()
{
global $post;
$name = single_term_title();
$terms = get_the_terms($post->ID, $name);
if ($terms && !wp_error($terms)) {
foreach ($terms as $term) {
echo $term->slug;
}
}
}
示例14: custom_archive_title
/**
* change title
*/
function custom_archive_title($title)
{
if (is_tax() || is_archive() || is_category()) {
$title = single_term_title('', false);
} else {
if (is_single()) {
$category = get_the_category();
$title = count($category) > 0 ? $category[0]->cat_name : $title;
}
}
return $title;
}
示例15: sketch_portfolio_title
/**
* Portfolio Title.
*/
function sketch_portfolio_title($before = '', $after = '')
{
$jetpack_portfolio_title = get_option('jetpack_portfolio_title');
$title = '';
if (is_post_type_archive('jetpack-portfolio')) {
if (isset($jetpack_portfolio_title) && '' != $jetpack_portfolio_title) {
$title = esc_html($jetpack_portfolio_title);
} else {
$title = post_type_archive_title('', false);
}
} elseif (is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag')) {
$title = single_term_title('', false);
}
echo $before . $title . $after;
}