本文整理汇总了PHP中get_the_archive_title函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_archive_title函数的具体用法?PHP get_the_archive_title怎么用?PHP get_the_archive_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_archive_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_archive_title
function get_archive_title()
{
$title = "";
$page_title = \get_the_archive_title();
if (\is_category()) {
//カテゴリーページ
$title = "『{$page_title』カテゴリーの記事}";
} elseif (\is_tag()) {
//タグページ
$title = "『{$page_title』タグが付けられた記事}";
} elseif (\is_tax()) {
//タクソノミーページ
$title = "『{$page_title』に分類された記事}";
} elseif (\is_author()) {
//作成者ページ
$title = "『{$page_title』が作成した記事}";
} elseif (\is_year() || \is_month() || \is_date()) {
//年
$title = "{$page_titleに作成された記事}";
} else {
//不明なアーカイブ
$title = $page_title;
}
return $title;
}
示例2: opengraph
public function opengraph()
{
$tags = [];
if (is_singular()) {
$tags['og:title'] = get_the_title();
} elseif (is_archive()) {
$tags['og:title'] = get_the_archive_title();
}
if (is_singular()) {
$tags['og:description'] = get_the_excerpt();
}
if (is_singular()) {
$tags['og:url'] = get_permalink();
} elseif (is_tax()) {
$tags['og:url'] = get_term_link(get_queried_object(), get_queried_object()->taxonomy);
}
if (is_singular() && has_post_thumbnail()) {
$tags['og:image'] = get_the_post_thumbnail_url('full');
}
$tags = wp_parse_args($tags, ['og:type' => 'website', 'og:title' => get_bloginfo('name'), 'og:description' => get_bloginfo('description'), 'og:url' => home_url('/'), 'og:image' => get_site_icon_url()]);
$tags = array_filter($tags);
$tags = apply_filters('opengraph_tags', $tags);
foreach ($tags as $property => $content) {
printf('
<meta property="%s" content="%s">', esc_attr($property), esc_attr($content));
}
}
示例3: zn_sensei_before_main_content
function zn_sensei_before_main_content()
{
$args = array();
if (!is_single()) {
// SHOW THE HEADER
if (empty($args['title'])) {
//** Put the header with title and breadcrumb
$args['title'] = __('Courses', 'zn_framework');
}
if (is_tax()) {
$args['title'] = get_the_archive_title();
$args['subtitle'] = '';
// Reset the subtitle for categories and tags
}
}
WpkPageHelper::zn_get_subheader($args);
global $zn_config;
$zn_config['force_sidebar'] = 'blog_sidebar';
$main_class = zn_get_sidebar_class('blog_sidebar');
if (strpos($main_class, 'right_sidebar') !== false || strpos($main_class, 'left_sidebar') !== false) {
$zn_config['sidebar'] = true;
} else {
$zn_config['sidebar'] = false;
}
$zn_config['size'] = $zn_config['sidebar'] ? 'col-sm-9' : 'col-sm-12';
?>
<section id="content" class="site-content shop_page">
<div class="container">
<div class="row">
<div class="<?php
echo $main_class;
?>
">
<?php
}
示例4: the_archive_title
/**
* Display the archive title based on the queried object.
*
* @since 1.0.0
*
* @see get_the_archive_title()
*
* @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 the_archive_title($before = '', $after = '')
{
$title = get_the_archive_title();
if (!empty($title)) {
echo $before . $title . $after;
}
}
示例5: get_page_title
/**
* get_page_title
*
* @return string|void
*/
protected function get_page_title()
{
if (empty($this->page_title)) {
$this->page_title = get_the_archive_title();
}
return $this->page_title;
}
示例6: context
/**
* Determine the context that will be used by the content() method
*/
public function context()
{
global $wp_query;
$context = Maera()->cache->get_context();
$post = new TimberPost();
$context['post'] = $post;
$context['posts'] = Timber::get_posts();
// Compatibility hack or plugins that change the content.
if ($this->plugins_compatibility()) {
$context['content'] = maera_get_echo('the_content');
}
if (is_singular()) {
$context['wp_title'] .= ' - ' . $post->title();
}
if (is_search()) {
$context['title'] = __('Search results for ', 'maera') . get_search_query();
}
if (is_archive() || is_home()) {
$context['posts'] = Timber::query_posts(false, 'TimberPost');
$context['title'] = get_the_archive_title();
if (is_author()) {
$author = new TimberUser($wp_query->query_vars['author']);
$context['author'] = $author;
}
}
if (class_exists('WooCommerce')) {
global $product;
$context['product'] = $product;
}
return $context;
}
示例7: title
/**
* Page titles
*/
function 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', 'sage');
}
} elseif (is_front_page()) {
return "<span>Lemon Tree Trust Homepage</span>";
} elseif (is_archive()) {
return get_the_archive_title();
} elseif (is_search()) {
return sprintf(__('Search Results for %s', 'sage'), get_search_query());
} elseif (is_404()) {
return __('Not Found', 'sage');
} elseif (is_page()) {
$full = get_the_title();
if (has_post_thumbnail($post->ID)) {
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
//echo $image[0];
echo "<div id='custom-bg' style='background-image: url(" . $image[0] . ")' > <div class='desc page_title'>";
echo '<h2>' . get_the_title() . '</h2></div> </div>';
}
//return $full;
} else {
return get_the_title();
}
}
示例8: jc_get_page_title
/**
* Gets the current page title.
*
* @since 1.3.0
*
* @param bool|string $title Page title override.
*
* @returns string The title.
*/
function jc_get_page_title($title = false)
{
if ($title !== false) {
$page_title = $title;
} else {
if (is_search()) {
$page_title = 'Search';
} elseif (is_404()) {
$page_title = '404';
} elseif (is_archive()) {
$page_title = get_the_archive_title();
} else {
$page_title = get_the_title(get_top_parent_page_id());
}
}
/**
* Filters the main (burgundy bar) page title.
*
* @since 0.4.0
* @hooked
*
* @param string $page_title The page title.
*/
echo apply_filters('jc_page_title', $page_title);
}
示例9: fp_get_archive_title
function fp_get_archive_title($pt)
{
$title = fp_get_archive_field($pt, '_title');
if (!$title) {
$title = get_the_archive_title();
}
return $title;
}
示例10: portland_archive_title
/**
* Archive title
*
* Displays the title for archive pages.
*
* @since 1.0.0
* @see https://developer.wordpress.org/reference/functions/the_archive_title/
*/
function portland_archive_title()
{
$portland_archive_title = get_the_archive_title();
if ('Archives' != $portland_archive_title) {
echo '<h1 class="page-title">' . $portland_archive_title . '</h1>';
}
the_archive_description('<p class="page-description">', '</p>');
}
示例11: beans_post_archive_title
/**
* Echo archive post title.
*
* @since 1.4.0
*/
function beans_post_archive_title()
{
if (!is_archive()) {
return;
}
beans_open_markup_e('beans_archive_title', 'h1', array('class' => 'uk-article-title'));
beans_output_e('beans_archive_title_text', get_the_archive_title());
beans_close_markup_e('beans_archive_title', 'h1');
}
示例12: satu_page_title
/**
* Site title.
*
* @since 1.0.0
*/
function satu_page_title()
{
if (is_singular()) {
echo '<h1 class="post-title page-title" itemprop="headline">' . esc_attr(get_the_title()) . '</h1>';
} elseif (is_archive()) {
echo '<h1 class="archive-title page-title" itemprop="headline">' . get_the_archive_title() . '</h1>';
} elseif (is_search()) {
echo '<h1 class="page-title">' . sprintf(esc_html__('Search Results for: %s', 'satu'), '<span class="result">' . get_search_query() . '</span>') . '</h1>';
} elseif (is_404()) {
echo '<h1 class="page-title">' . esc_html__('Oops! That page can’t be found.', 'satu') . '</h1>';
} else {
echo '<h1 class="site-title"><a href="' . esc_url(get_home_url()) . '" itemprop="url" rel="home"><span itemprop="headline">' . esc_attr(get_bloginfo('name')) . '</span></a></h1>';
}
}
示例13: get_title
public function get_title()
{
$separator = $this->title_separator;
$use_wp_title = $this->use_wp_title_function;
// Disabling 'title-tag' feature.
$activate_title_tag_back = false;
if ($use_wp_title && get_theme_support('title-tag')) {
remove_theme_support('title-tag');
$activate_title_tag_back = true;
}
$q = $GLOBALS['wp_query'];
if ($q->get('wc_query') && function_exists('woocommerce_page_title')) {
if ($separator) {
$separator = '';
}
$title = woocommerce_page_title(false);
} else {
$is_home = is_home();
$is_front_page = is_front_page();
if ($is_home || $is_front_page) {
if ($is_home && $is_front_page) {
$title = get_bloginfo('name');
} elseif ($is_home) {
$title = get_the_title(get_option('page_for_posts'));
} elseif ($is_front_page) {
$title = get_the_title(get_option('page_on_front'));
}
} else {
if ($use_wp_title) {
$title = wp_title($separator, false);
} else {
$title = is_singular() ? get_the_title(get_queried_object()) : strip_tags(get_the_archive_title());
}
}
}
// Restoring 'title-tag' feature.
if ($activate_title_tag_back) {
// add_theme_support( 'title-tag' );
$GLOBALS['_wp_theme_features']['title-tag'] = true;
}
if ($title) {
if ($separator) {
$title = substr($title, strlen($separator) + 1);
}
$title = trim($title);
}
return $title;
}
示例14: title
function title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
return get_the_title(get_option('page_for_posts', true));
}
return 'Últimos posts';
} elseif (is_archive()) {
return get_the_archive_title();
} elseif (is_search()) {
return sprintf('Resultado da pesquisa para %s', get_search_query());
} elseif (is_404()) {
return 'Nada encontrado';
}
return get_the_title();
}
示例15: title
/**
* Page titles
*/
function title()
{
if (is_home()) {
if (get_option('page_for_posts', true)) {
return get_the_title(get_option('page_for_posts', true));
} else {
}
} elseif (is_archive()) {
return get_the_archive_title();
} elseif (is_search()) {
return sprintf(__('Search Results for %s', 'sage'), get_search_query());
} elseif (is_404()) {
return __('Not Found', 'sage');
} else {
return get_the_title();
}
}