本文整理汇总了PHP中get_the_archive_description函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_archive_description函数的具体用法?PHP get_the_archive_description怎么用?PHP get_the_archive_description使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_archive_description函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: archive_content_header
/**
* アーカイブページのコンテンツヘッダーを表示
*/
function archive_content_header($is_print = false)
{
$title = archive_title();
//get_the_archive_description()は<p>でラップされているので、取り除く
$desc = \is_home() ? \get_bloginfo('description') : \get_the_archive_description();
$description = \esc_html(\strip_tags($desc));
$count = \esc_html($GLOBALS['wp_query']->found_posts);
$attr = $count ? "" : " hidden";
$html = <<<EOD
<header class="header">
\t<h1><span>{$title}</span></h1>
\t<div class="description">{$description}</div>
\t<div class="count"{$attr}><span class="post-count">{$count}</span>件の記事</div>
</header>
EOD;
if ($is_print) {
echo $html;
return true;
} else {
return $html;
}
}
示例2: hybrid_get_loop_description
/**
* Gets the loop description. This function should only be used on archive-type pages, such as archive, blog, and
* search results pages. It outputs the description of the page.
*
* @link http://core.trac.wordpress.org/ticket/21995
* @since 2.0.0
* @deprecated 3.0.0
* @access public
* @return string
*/
function hybrid_get_loop_description()
{
_deprecated_function(__FUNCTION__, '3.0.0', 'get_the_archive_description()');
return get_the_archive_description();
}
示例3: meta_description
/**
* add meta_description
*
* hook after post has loaded to add a unique meta-description
*
*/
public static function meta_description()
{
$post = new \TimberPost();
// check for custom field
$description = wptexturize($post->get_field('meta_description'));
if (is_tax()) {
if ($temp = term_description(get_queried_object(), get_query_var('taxonomy'))) {
$description = $temp;
}
} elseif (is_post_type_archive()) {
if ($temp = get_the_archive_description()) {
$description = $temp;
}
}
// else use preview
if (empty($description)) {
$description = str_replace('', "'", $post->get_preview(40, true, false, true));
}
// finally use the blog description
if (empty($description)) {
$description = get_bloginfo('description', 'raw');
}
$description = esc_attr(wp_strip_all_tags($description));
// limit to SEO recommended length
if (strlen($description) > 155) {
$description = substr($description, 0, 155);
$description = \TimberHelper::trim_words($description, str_word_count($description) - 1);
}
return $description;
}
示例4: the_archive_description
/**
* Display category, tag, or term description.
*
* @since 4.1.0
*
* @see get_the_archive_description()
*
* @param string $before Optional. Content to prepend to the description. Default empty.
* @param string $after Optional. Content to append to the description. Default empty.
*/
function the_archive_description($before = '', $after = '')
{
$description = get_the_archive_description();
if ($description) {
echo $before . $description . $after;
}
}
示例5: elseif
?>
</h1>
<div class="divider-small"></div>
<?php
} elseif (is_tax()) {
?>
<h1 class="archive-title"><?php
single_term_title();
?>
</h1>
<?php
$description = get_the_archive_description();
if ($description) {
echo '<div class="keynote">' . $description . '</div>';
} else {
echo '<div class="divider-small"></div>';
}
?>
<?php
} elseif (is_author()) {
?>
<?php
$curauth = isset($_GET['author_name']) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
?>
示例6: elseif
} elseif (is_tax('post_format', 'post-format-link')) {
_e('Links', 'some-like-it-neat');
} elseif (is_tax()) {
+single_term_title();
} else {
_e('Archives', 'some-like-it-neat');
}
/*
* END TO-DO
*/
?>
</h1>
<?php
// Show an optional term description.
if (function_exists('get_the_archive_description')) {
echo '<div class="taxonomy-description">' . get_the_archive_description() . '</div>';
/*
* TO-DO Might remove this code block at some point, since
* get_the_archive_description() does the same thing
* the below code does
*/
} elseif ($term_description = term_description()) {
printf('<div class="taxonomy-description">%s</div>', $term_description);
}
?>
</header><!-- .page-header -->
<?php
/* Start the Loop */
?>
<?php
示例7: hybrid_attr
<header <?php
hybrid_attr('archive-header');
?>
>
<h1 <?php
hybrid_attr('archive-title');
?>
><?php
the_archive_title();
?>
</h1>
<?php
if (!is_paged() && ($desc = get_the_archive_description())) {
// Check if we're on page/1.
?>
<div <?php
hybrid_attr('archive-description');
?>
>
<?php
echo $desc;
?>
</div><!-- .archive-description -->
<?php
}
// End paged check.
?>
示例8: buildArchiveCard
/**
* Build a card for an archive view
*
* @since 1.0.0
*
* @return \Twitter\Cards\Card|null Twitter Card object or null if minimum requirements not met
*/
public static function buildArchiveCard()
{
$query_type = 'archive';
$card = static::getCardObject($query_type);
if (!$card) {
return;
}
// WP 4.1+ functions
if (function_exists('get_the_archive_title')) {
/** This filter is documented in ::buildHomepageCard */
$title = apply_filters('twitter_card_title', get_the_archive_title(), $query_type, null);
if ($title) {
$card->setTitle(\Twitter\WordPress\Cards\Sanitize::sanitizePlainTextString($title));
}
unset($title);
}
if (method_exists($card, 'setDescription') && function_exists('get_the_archive_description')) {
/** This filter is documented in ::buildHomepageCard */
$description = apply_filters('twitter_card_description', get_the_archive_description(), $query_type, null);
if ($description) {
$card->setDescription(\Twitter\WordPress\Cards\Sanitize::sanitizeDescription($description));
}
unset($description);
}
return $card;
}
示例9: get_the_tags
$markup .= '</ul>';
$posttags = get_the_tags();
if ($posttags) {
$markup .= '<ul class="entry-tags">';
foreach ($posttags as $tag) {
$markup .= '<li><a href="' . get_tag_link($tag->term_id) . '">#' . $tag->name . '</a></li>';
}
$markup .= '</ul>';
}
}
echo $markup;
} else {
if (is_archive()) {
$markup = '<h1 class="cover__title">' . get_the_archive_title() . '</h1>';
if (get_the_archive_description()) {
$markup .= '<p class="cover__text">' . get_the_archive_description() . '</p>';
}
} elseif (is_404()) {
$markup = '<h1 class="cover__title">' . esc_html('Oops! You went too far!', 'eduardodomingos') . '</h1>';
$markup .= '<p class="cover__text">' . esc_html('Houston we have a problem! That page can’t be found.', 'eduardodomingos') . '</p>';
} else {
$markup = '<h1 class="cover__title">' . single_post_title('', false) . '</h1>';
if (is_home()) {
// ACF needs to specify the Blog page ID in the get_field function.
$slug = get_page_by_path('blog');
if (get_field('cover_text', $slug->ID)) {
$markup .= '<p class="cover__text">' . get_field('cover_text', $slug->ID) . '</p>';
}
} else {
if (get_field('cover_text')) {
$markup .= '<p class="cover__text">' . get_field('cover_text') . '</p>';
示例10: alpha_archive_description
/**
* Output the archive description.
*
* @since 1.0.0
* @access public
* @return void
*/
function alpha_archive_description()
{
if (!is_paged() && ($desc = get_the_archive_description())) {
printf('<div %s>%s</div><!-- .archive-description -->', alpha_get_attr('archive-description'), $desc);
}
}
示例11: sketch_portfolio_content
/**
* Portfolio Content.
*/
function sketch_portfolio_content($before = '', $after = '')
{
$jetpack_portfolio_content = get_option('jetpack_portfolio_content');
if (is_tax() && get_the_archive_description()) {
echo $before . get_the_archive_description() . $after;
} else {
if (isset($jetpack_portfolio_content) && '' != $jetpack_portfolio_content) {
$content = convert_chars(convert_smilies(wptexturize(stripslashes(wp_filter_post_kses(addslashes($jetpack_portfolio_content))))));
echo $before . $content . $after;
}
}
}
示例12: loadArchiveTemplate
protected function loadArchiveTemplate(&$templates, &$context)
{
$post_types = array_filter((array) get_query_var('post_type'));
if (count($post_types) == 1) {
$post_type = reset($post_types);
$templates[] = "archive-{$post_type}.twig";
}
$templates[] = 'archive.twig';
$context['title'] = get_the_archive_title();
$context['description'] = get_the_archive_description();
}
示例13: get_the_archive_description
<?php
/**
* Generates subtitle
* @requires $subtitle
*/
$item_string .= '<div class="component-element sub-title"><h4 class="archive-description sub-title-header">';
$item_string .= get_the_archive_description();
$item_string .= '</h4></div>';
示例14: get_the_archive_title
}
?>
<?php
}
?>
<?php
if (is_archive()) {
?>
<h1 class="archive_title">
<?php
echo get_the_archive_title();
?>
</h1>
<p>
<?php
echo get_the_archive_description();
?>
</p>
<?php
}
?>
<div class="googlemaps">
<div class="googlemaps-buttons">
<div class="btn-group">
<a href="#googlemaps-posts" class="btn btn-default googlemap-show-list">
<?php
_e('show list', 'dimme-jour');
?>
</a>
<a href="#googlemaps-map" class="btn btn-default googlemap-show-map">
<?php
示例15: screenr_page_header_cover
/**
* Setup page header cover
*
* @return bool
*/
function screenr_page_header_cover()
{
if (is_page_template('template-frontpage.php')) {
return false;
}
$image = $title = $desc = '';
if (is_singular() && !is_attachment()) {
if (is_single()) {
$title = esc_html(get_theme_mod('page_blog_title', esc_html__('The Blog', 'screenr')));
} else {
$title = get_the_title();
}
} elseif (is_search()) {
$title = sprintf(esc_html__('Search Results for: %s', 'screenr'), '<span>' . esc_html(get_search_query()) . '</span>');
} elseif ((is_home() || is_front_page()) && !is_attachment()) {
$title = esc_html(get_theme_mod('page_blog_title', esc_html__('The Blog', 'screenr')));
} elseif (is_404()) {
$title = sprintf(esc_html__('%s 404 Not Found!', 'screenr'), '<i class="fa fa-frown-o"></i><br>');
} else {
$title = get_the_archive_title();
$desc = get_the_archive_description();
}
if (!$image) {
$image = get_header_image();
}
$is_parallax = true;
$item = array('position' => 'center', 'pd_top' => get_theme_mod('page_header_pdtop') == '' ? 13 : get_theme_mod('page_header_pdtop'), 'pd_bottom' => get_theme_mod('page_header_pdbottom') == '' ? 13 : get_theme_mod('page_header_pdbottom'), 'title' => $title, 'desc' => $desc, 'image' => $image);
$classes = array('section-slider', 'swiper-slider');
if ($is_parallax) {
$classes[] = 'fixed';
}
$item = apply_filters('screenr_page_header_item', $item);
if ($item['image']) {
$classes[] = 'has-image';
} else {
$classes[] = 'no-image';
}
$classes = apply_filters('screenr_page_header_cover_class', $classes);
?>
<section id="page-header-cover" class="<?php
echo esc_attr(join(' ', $classes));
?>
" >
<div class="swiper-container" data-autoplay="0">
<div class="swiper-wrapper">
<?php
$style = "";
if ($item['image']) {
$style = ' style="background-image: url(\'' . esc_url($item['image']) . '\');" ';
}
$html = '<div class="swiper-slide slide-align-' . esc_attr($item['position']) . '"' . $style . '>';
$style = '';
if ($item['pd_top'] != '') {
$style .= 'padding-top: ' . floatval($item['pd_top']) . '%; ';
}
if ($item['pd_bottom'] != '') {
$style .= 'padding-bottom: ' . floatval($item['pd_bottom']) . '%; ';
}
if ($style != '') {
$style = ' style="' . $style . '" ';
}
$html .= '<div class="swiper-slide-intro">';
$html .= '<div class="swiper-intro-inner"' . $style . '>';
if ($item['title']) {
$html .= '<h2 class="swiper-slide-heading">' . wp_kses_post($item['title']) . '</h2>';
}
if ($item['desc']) {
$html .= '<div class="swiper-slide-desc">' . apply_filters('screenr_content_text', $item['desc']) . '</div>';
}
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="overlay"></div>';
$html .= '</div>';
echo $html;
?>
</div>
</div>
</section>
<?php
}