当前位置: 首页>>代码示例>>PHP>>正文


PHP get_the_archive_title函数代码示例

本文整理汇总了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;
}
开发者ID:Aquei,项目名称:purely,代码行数:25,代码来源:purely-funcs.php

示例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));
        }
    }
开发者ID:tomjal,项目名称:feelingrestful-theme,代码行数:27,代码来源:class-opengraph.php

示例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 
}
开发者ID:rock1media,项目名称:wordpress,代码行数:35,代码来源:functions-sensei.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;
     }
 }
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:17,代码来源:back-compat.php

示例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;
 }
开发者ID:benedict-w,项目名称:pressgang,代码行数:12,代码来源:posts-controller.php

示例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;
 }
开发者ID:wpmu,项目名称:maera,代码行数:34,代码来源:class-maera-template.php

示例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();
    }
}
开发者ID:girl-elvis,项目名称:citizensage,代码行数:32,代码来源:titles.php

示例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);
}
开发者ID:JacksonCollege,项目名称:jc-theme-2015,代码行数:34,代码来源:theme-functions.php

示例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;
}
开发者ID:CodeProKid,项目名称:fruitpack,代码行数:8,代码来源:template-tags.php

示例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>');
}
开发者ID:aaronjamesyoung,项目名称:portland,代码行数:16,代码来源:index.php

示例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');
}
开发者ID:Getbeans,项目名称:Beans,代码行数:14,代码来源:post.php

示例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&rsquo;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>';
     }
 }
开发者ID:satrya,项目名称:satu,代码行数:19,代码来源:template-tags.php

示例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;
 }
开发者ID:j-kenneth,项目名称:Expeero,代码行数:48,代码来源:AtHeaderSection.php

示例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();
}
开发者ID:cc-mkt,项目名称:setrobot,代码行数:16,代码来源:read.php

示例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();
    }
}
开发者ID:bobderrico80,项目名称:nymb-v2,代码行数:20,代码来源:titles.php


注:本文中的get_the_archive_title函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。