/** * アーカイブページのコンテンツヘッダーを表示 */ 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; } }
/** * 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(); }
/** * 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; }
/** * 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; } }
?> </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)); ?>
} 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
<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. ?>
/** * 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; }
$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>';
/** * 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); } }
/** * 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; } } }
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(); }
<?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>';
} ?> <?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
/** * 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 }
/** * Get page tagline * * @return mixed|void */ function kt_get_page_subtitle() { global $post; $tagline = ''; if (is_front_page() && !is_singular('page')) { $tagline = esc_html__('Lastest posts', 'wingman'); } elseif (is_home()) { $page_for_posts = get_option('page_for_posts', true); $tagline = nl2br(rwmb_meta('_kt_page_header_subtitle', array(), $page_for_posts)); } elseif (is_front_page() && is_singular('page')) { $tagline = rwmb_meta('_kt_page_header_subtitle'); } elseif (is_archive()) { $tagline = get_the_archive_description(); if (kt_is_wc()) { if (is_shop()) { $shop_page_id = get_option('woocommerce_shop_page_id'); $tagline = rwmb_meta('_kt_page_header_subtitle', array(), $shop_page_id); } if (is_product_category() || is_product_tag()) { $tagline = ''; } } } elseif (is_search()) { $tagline = ''; } elseif ($post) { $post_id = $post->ID; $tagline = nl2br(rwmb_meta('_kt_page_header_subtitle', array(), $post_id)); } return apply_filters('kt_subtitle', $tagline); }
/** * get_post_share_details * * Generate post sharing details * * @param string $position * @return array */ function get_post_share_details($position) { global $post; if ($this->general_options['reset_postdata']) { wp_reset_postdata(); } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_wp_query_postid')) { $current_query_id = get_queried_object_id(); $post = get_post($current_query_id); } $url = ""; $title = ""; $image = ""; $description = ""; $title_plain = ""; $twitter_user = $this->network_options['twitter_user']; $twitter_hashtags = $this->network_options['twitter_hashtags']; $twitter_customtweet = ""; $url = $post ? get_permalink() : ESSBUrlHelper::get_current_url('raw'); if (ESSBOptionValuesHelper::options_bool_value($this->options, 'avoid_nextpage')) { $url = $post ? get_permalink(get_the_ID()) : ESSBUrlHelper::get_current_url('raw'); } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_wp_fullurl')) { $url = ESSBUrlHelper::get_current_page_url(); } if (ESSBOptionValuesHelper::options_bool_value($this->options, 'always_use_http')) { $url = str_replace("https://", "http://", $url); } if (!defined('ESSB3_LIGHTMODE')) { $mycred_referral_activate = ESSBOptionValuesHelper::options_bool_value($this->options, 'mycred_referral_activate'); if ($mycred_referral_activate && function_exists('mycred_render_affiliate_link')) { $url = mycred_render_affiliate_link(array('url' => $url)); } } if (isset($post)) { $title = esc_attr(urlencode($post->post_title)); $title_plain = $post->post_title; $image = ESSBCoreHelper::get_post_featured_image($post->ID); $description = $post->post_excerpt; if ($position == "heroshare") { if ($description == "") { $working_post_content = $post->post_content; $working_post_content = strip_tags($working_post_content); $working_post_content = preg_replace('/\\s+/', ' ', $working_post_content); $working_post_content = strip_shortcodes($working_post_content); $working_post_content = trim($working_post_content); $working_post_content = substr($working_post_content, 0, 400); $description = $working_post_content; } } } $list_of_articles_mode = false; if (is_archive() || is_front_page() || is_search() || is_tag() || is_post_type_archive()) { if ($position == "sidebar" || $position == "flyin" || $position == "popup" || $position == "topbar" || $position == "bottombar") { if (ESSBOptionValuesHelper::options_bool_value($this->options, 'force_archive_pages')) { $list_of_articles_mode = true; $url = ESSBUrlHelper::get_current_page_url(); if (is_front_page()) { $title = get_bloginfo('name'); $title_plain = $title; $description = get_bloginfo('description'); } else { $title = get_the_archive_title(); $title_plain = $title; $description = get_the_archive_description(); } } } } // apply custom share options if ($this->general_options['customshare']) { if ($this->general_options['customshare_text'] != '') { $title = $this->general_options['customshare_text']; $title_plain = $title; } if ($this->general_options['customshare_url'] != '') { $url = $this->general_options['customshare_url']; } if ($this->general_options['customshare_image'] != '') { $image = $this->general_options['customshare_image']; } if ($this->general_options['customshare_description'] != '') { $description = $this->general_options['customshare_description']; } } $twitter_customtweet = $title; $post_pin_image = ""; // apply post custom share options if (isset($post) && !$list_of_articles_mode) { $twitter_message_tags_to_hashtags = ESSBOptionValuesHelper::options_bool_value($this->options, 'twitter_message_tags_to_hashtags'); if ($twitter_message_tags_to_hashtags) { $post_tags = wp_get_post_tags($post->ID); if ($post_tags) { $generated_tags = array(); foreach ($post_tags as $tag) { $current_tag = $tag->name; $current_tag = str_replace(' ', '', $current_tag); $generated_tags[] = $current_tag; } if (count($generated_tags) > 0) { $twitter_hashtags = implode(',', $generated_tags); } } } $post_essb_post_share_message = get_post_meta($post->ID, 'essb_post_share_message', true); $post_essb_post_share_url = get_post_meta($post->ID, 'essb_post_share_url', true); $post_essb_post_share_image = get_post_meta($post->ID, 'essb_post_share_image', true); $post_essb_post_share_text = get_post_meta($post->ID, 'essb_post_share_text', true); $post_pin_image = get_post_meta($post->ID, 'essb_post_pin_image', true); $post_essb_twitter_username = get_post_meta($post->ID, 'essb_post_twitter_username', true); $post_essb_twitter_hastags = get_post_meta($post->ID, 'essb_post_twitter_hashtags', true); $post_essb_twitter_tweet = get_post_meta($post->ID, 'essb_post_twitter_tweet', true); if ($post_essb_post_share_image != '') { $image = $post_essb_post_share_image; } if ($post_essb_post_share_message != '') { $description = $post_essb_post_share_message; } if ($post_essb_post_share_text != '') { $title = $post_essb_post_share_text; $title_plain = $post_essb_post_share_text; } if ($post_essb_post_share_url != '') { $url = $post_essb_post_share_url; } if ($post_essb_twitter_hastags != '') { $twitter_hashtags = $post_essb_twitter_hastags; } if ($post_essb_twitter_tweet != '') { $twitter_customtweet = $post_essb_twitter_tweet; } if ($post_essb_twitter_username != '') { $twitter_user = $post_essb_twitter_username; } } // inetegration with affiliate plugins is not availalbe as option in easy mode if (!defined('ESSB3_LIGHTMODE')) { $affwp_active = ESSBOptionValuesHelper::options_bool_value($this->options, 'affwp_active'); if ($affwp_active) { $url = ESSBUrlHelper::generate_affiliatewp_referral_link($url); } $affs_active = ESSBOptionValuesHelper::options_bool_value($this->options, 'affs_active'); if ($affs_active) { $url = do_shortcode('[affiliates_url]' . $url . '[/affiliates_url]'); } } $title = str_replace("'", "\\'", $title); $description = str_replace("'", "\\'", $description); $twitter_customtweet = str_replace("'", "\\'", $twitter_customtweet); $title_plain = str_replace("'", "\\'", $title_plain); return array("url" => $url, "title" => $title, "image" => $image, "description" => $description, "twitter_user" => $twitter_user, "twitter_hashtags" => $twitter_hashtags, "twitter_tweet" => $twitter_customtweet, "post_id" => isset($post) ? $post->ID : 0, "user_image_url" => "", "title_plain" => $title_plain, 'short_url_whatsapp' => '', 'short_url_twitter' => '', 'short_url' => '', 'pinterest_image' => $post_pin_image); }
/** * Default description property, using the excerpt or content for posts, or the * bloginfo description. */ function opengraph_default_description($description) { if (empty($description)) { if (is_singular()) { $post = get_queried_object(); if (!empty($post->post_excerpt)) { $description = $post->post_excerpt; } else { $description = $post->post_content; } } else { if (is_author()) { $id = get_queried_object_id(); $description = get_user_meta($id, 'description', true); } else { if (is_category() && category_description()) { $description = category_description(); } else { if (is_tag() && tag_description()) { $description = tag_description(); } else { if (is_archive() && function_exists("get_the_archive_description") && get_the_archive_description()) { // new in version 4.1 to get all other archive descriptions $description = get_the_archive_description(); } else { $description = get_bloginfo('description'); } } } } } } // strip description to first 55 words. $description = strip_tags(strip_shortcodes($description)); $description = __opengraph_trim_text($description); return $description; }
> <?php if (is_home() && !is_front_page()) { $toivo_archive_title = get_post_field('post_title', get_queried_object_id()); $toivo_loop_desc = get_post_field('post_content', get_queried_object_id(), 'raw'); } elseif (is_search()) { /* Translators: %s is the search query. The HTML entities are opening and closing curly quotes. */ $toivo_archive_title = sprintf(__('Search results for “%s”', 'toivo-lite'), get_search_query()); $toivo_loop_desc = sprintf(__('You are browsing the search results for “%s”', 'toivo-lite'), get_search_query()); } elseif (is_author()) { $toivo_archive_title = get_the_archive_title(); $toivo_loop_desc = get_the_author_meta('description', get_query_var('author')); } else { $toivo_archive_title = get_the_archive_title(); $toivo_loop_desc = get_the_archive_description(); } ?> <h1 class="site-title loop-title" <?php hybrid_attr('loop-title'); ?> ><?php echo $toivo_archive_title; ?> </h1> <?php if ($toivo_loop_desc) { ?>
/** * Return 1) the archive title html content OR 2) the archive title class OR 3) the boolean * hook : tc_display_customizr_headings * @return boolean * * @package Customizr * @since Customizr 3.2.0 */ function tc_archive_title_and_class_callback($_title = null, $_return_class = false) { //declares variables to return $content = false; $_header_class = false; //case page for posts but not on front global $wp_query; if ($wp_query->is_posts_page && !is_front_page()) { //get page for post ID $page_for_post_id = get_option('page_for_posts'); $_header_class = array('entry-header'); if ($_return_class) { return $_header_class; } $content = sprintf('<%1$s class="entry-title %2$s">%3$s</%1$s>', apply_filters('tc_content_title_tag', 'h1'), apply_filters('tc_content_title_icon', 'format-icon'), get_the_title($page_for_post_id)); $content = apply_filters('tc_page_for_post_header_content', $content); } else { if (is_404()) { $_header_class = array('entry-header'); if ($_return_class) { return $_header_class; } $content = sprintf('<h1 class="entry-title %1$s">%2$s</h1>', apply_filters('tc_archive_icon', ''), apply_filters('tc_404_title', __('Ooops, page not found', 'customizr'))); $content = apply_filters('tc_404_header_content', $content); } else { if (is_search() && !is_singular()) { $_header_class = array('search-header'); if ($_return_class) { return $_header_class; } $content = sprintf('<div class="row-fluid"><div class="%1$s"><h1 class="%2$s">%3$s%4$s %5$s </h1></div><div class="%6$s">%7$s</div></div>', apply_filters('tc_search_result_header_title_class', 'span8'), apply_filters('tc_archive_icon', 'format-icon'), have_posts() ? '' : __('No', 'customizr') . ' ', apply_filters('tc_search_results_title', __('Search Results for :', 'customizr')), '<span>' . get_search_query() . '</span>', apply_filters('tc_search_result_header_form_class', 'span4'), have_posts() ? get_search_form(false) : ''); $content = apply_filters('tc_search_results_header_content', $content); } else { if (is_archive()) { $_header_class = array('archive-header'); if ($_return_class) { return $_header_class; } //author's posts page if (is_author()) { //gets the user ID $user_id = get_query_var('author'); $content = sprintf('<h1 class="%1$s">%2$s %3$s</h1>', apply_filters('tc_archive_icon', 'format-icon'), apply_filters('tc_author_archive_title', __('', 'customizr')), '<span class="vcard">' . get_the_author_meta('display_name', $user_id) . '</span>'); if (apply_filters('tc_show_author_meta', get_the_author_meta('description', $user_id))) { $content .= sprintf('%1$s<div class="author-info"><div class="%2$s">%3$s</div></div>', apply_filters('tc_author_meta_separator', '<hr class="featurette-divider ' . current_filter() . '">'), apply_filters('tc_author_meta_wrapper_class', 'row-fluid'), sprintf('<div class="%1$s">%2$s</div><div class="%3$s"><h2>%4$s</h2><p>%5$s</p></div>', apply_filters('tc_author_meta_avatar_class', 'comment-avatar author-avatar span2'), get_avatar(get_the_author_meta('user_email', $user_id), apply_filters('tc_author_bio_avatar_size', 100)), apply_filters('tc_author_meta_content_class', 'author-description span10'), sprintf(__('About %s', 'customizr'), get_the_author()), get_the_author_meta('description', $user_id))); } $content = apply_filters('tc_author_header_content', $content); } else { if (is_category()) { $content = sprintf('<h1 class="%1$s">%2$s %3$s</h1>', apply_filters('tc_archive_icon', 'format-icon'), apply_filters('tc_category_archive_title', __('', 'customizr')), '<span>' . single_cat_title('', false) . '</span>'); if (apply_filters('tc_show_cat_description', category_description())) { $content .= sprintf('<div class="archive-meta">%1$s</div>', category_description()); } $content = apply_filters('tc_category_archive_header_content', $content); } else { if (is_tag()) { $content = sprintf('<h1 class="%1$s">%2$s %3$s</h1>', apply_filters('tc_archive_icon', 'format-icon'), apply_filters('tc_tag_archive_title', __('', 'customizr')), '<span>' . single_tag_title('', false) . '</span>'); if (apply_filters('tc_show_tag_description', tag_description())) { $content .= sprintf('<div class="archive-meta">%1$s</div>', tag_description()); } $content = apply_filters('tc_tag_archive_header_content', $content); } else { if (is_day() || is_month() || is_year()) { $archive_type = is_day() ? sprintf(__('Daily Archives: %s', 'customizr'), '<span>' . get_the_date() . '</span>') : __('Archives', 'customizr'); $archive_type = is_month() ? sprintf(__('Monthly Archives: %s', 'customizr'), '<span>' . get_the_date(_x('F Y', 'monthly archives date format', 'customizr')) . '</span>') : $archive_type; $archive_type = is_year() ? sprintf(__('Yearly Archives: %s', 'customizr'), '<span>' . get_the_date(_x('Y', 'yearly archives date format', 'customizr')) . '</span>') : $archive_type; $content = sprintf('<h1 class="%1$s">%2$s</h1>', apply_filters('tc_archive_icon', 'format-icon'), $archive_type); $content = apply_filters('tc_time_archive_header_content', $content); } else { if (apply_filters('tc_show_tax_archive_title', true)) { $content = sprintf('<h1 class="%1$s">%2$s</h1>', apply_filters('tc_archive_icon', 'format-icon'), apply_filters('tc_tax_archive_title', get_the_archive_title())); $tax_description = get_the_archive_description(); if (apply_filters('tc_show_tax_description', $tax_description)) { $content .= sprintf('<div class="archive-meta">%1$s</div>', $tax_description); } $content = apply_filters('tc_tax_archive_header_content', $content); } } } } } } } } } // end all archives return $_return_class ? $_header_class : $content; }
<?php $context = Timber::get_context(); $context['posts'] = Timber::get_posts(); if (is_archive()) { $context['title'] = get_the_archive_title(); } else { $context['title'] = get_the_title(get_option('page_for_posts')); } $context['description'] = get_the_archive_description('<div class="archive-description">', '</div>'); $context['pagination'] = Timber::get_pagination(array('mid_size' => 2)); Timber::render('index.twig', $context);
function layers_get_page_title() { global $post; // Setup return $title_array = array(); if (!empty($parentpage) && !is_search()) { $parentpage = get_template_link(get_post_type() . ".php"); $title_array['title'] = $parentpage->post_title; if ($parentpage->post_excerpt != '') { $title_array['excerpt'] = $parentpage->post_excerpt; } } elseif (is_page()) { while (have_posts()) { the_post(); $title_array['title'] = get_the_title(); if ($post->post_excerpt != "") { $title_array['excerpt'] = strip_tags(get_the_excerpt()); } } } elseif (is_search()) { $title_array['title'] = __('Search', 'layerswp'); $title_array['excerpt'] = get_search_query(); } elseif (is_tag()) { $title_array['title'] = single_tag_title('', false); $title_array['excerpt'] = get_the_archive_description(); } elseif (!is_page() && is_category()) { $title_array['title'] = single_cat_title('', false); $title_array['excerpt'] = get_the_archive_description(); } elseif (!is_page() && get_query_var('term') != '') { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $title_array['title'] = $term->name; $title_array['excerpt'] = $term->description; } elseif (is_author()) { $title_array['title'] = get_the_author(); $title_array['excerpt'] = get_the_author_meta('user_description'); } elseif (is_day()) { $title_array['title'] = sprintf(__('Daily Archives: %s', 'layerswp'), get_the_date()); } elseif (is_month()) { $title_array['title'] = sprintf(__('Monthly Archives: %s', 'layerswp'), get_the_date(_x('F Y', 'monthly archives date format', 'layerswp'))); } elseif (is_year()) { $title_array['title'] = sprintf(__('Yearly Archives: %s', 'layerswp'), get_the_date(_x('Y', 'yearly archives date format', 'layerswp'))); } elseif (function_exists('is_shop') && (is_post_type_archive('product') || get_post_type() == "product")) { if (function_exists('woocommerce_get_page_id') && -1 != woocommerce_get_page_id('shop')) { $shop_page = get_post(woocommerce_get_page_id('shop')); if (is_object($shop_page)) { $title_array['title'] = $shop_page->post_title; } } else { $title_array['title'] = __('Shop', 'layerswp'); } } elseif (is_single()) { $title_array['title'] = get_the_title(); } else { $title_array['title'] = __('Archives', 'layerswp'); } return apply_filters('layers_get_page_title', $title_array); }
/** * Get page tagline * * @return mixed|void */ function kt_get_page_subtitle() { global $post; $subtitle = ''; if (is_front_page() && !is_singular('page')) { $subtitle = __('Lastest posts', 'adroit'); } elseif (is_home()) { $page_for_posts = get_option('page_for_posts', true); $subtitle = nl2br(rwmb_meta('_kt_page_header_subtitle', array(), $page_for_posts)); } elseif (is_front_page() && is_singular('page')) { $subtitle = rwmb_meta('_kt_page_header_subtitle'); } elseif (is_archive()) { $subtitle = get_the_archive_description(); if (!$subtitle) { if (is_category()) { $category_current = get_category(get_query_var('cat')); $categories = get_categories(array('child_of' => $category_current->term_id)); if (count($categories)) { $subtitle .= '<ul class="category_children">'; $subtitle .= sprintf('<li class="active"><a href="%s">%s</a></li>', get_category_link($category_current->term_id), __('All', 'adroit')); foreach ($categories as $category) { $subtitle .= sprintf('<li><a href="%s">%s</a></li>', get_category_link($category->term_id), $category->cat_name); } $subtitle .= '</ul>'; } else { $subtitle = sprintf(__('%s posts', 'adroit'), $category_current->count); } } elseif (is_tag() || is_author() || is_year() || is_month() || is_day()) { global $wp_query; $subtitle = sprintf(__('%s posts', 'adroit'), $wp_query->found_posts); } } } elseif (is_search()) { global $wp_query; $subtitle = sprintf(__('%s posts', 'adroit'), $wp_query->found_posts); } elseif ($post) { $post_id = $post->ID; $subtitle = nl2br(rwmb_meta('_kt_page_header_subtitle', array(), $post_id)); } $subtitle = apply_filters('kt_subtitle', $subtitle); if ($subtitle) { $subtitle = sprintf('<div class="%s">%s</div>', 'page-subtitle', $subtitle); } return $subtitle; }
/** * * @since1.272 */ function raindrops_add_header_archive_description() { if (is_category() || is_tag()) { $html = '<meta name="%1$s" content="%2$s" />' . "\n"; $raindrops_archive_description_length = apply_filters('raindrops_archive_description_length', 115); $description = wp_kses(get_the_archive_description(), array()); $description = wp_html_excerpt($description, $raindrops_archive_description_length, ''); if (!empty($description)) { $result = sprintf($html, 'description', $description); echo apply_filters('raindrops_add_header_archive_description', $result); } } }
/** * Site banner action * * @return void * @author **/ function hb_site_banner() { $hb_page_has_banner = apply_filters('hb_page_has_banner', true); $is_page_landing = is_page_template('page-landing.php'); if (!$is_page_landing && !$hb_page_has_banner) { return; } $args = array('title' => '', 'subtitle' => '', 'over_content' => false, 'fallback' => 'hb_banner_default'); if (is_home() && !is_front_page()) { $args['title'] = get_option('blogdescription'); $args['over_content'] = true; } elseif (is_page() && $is_page_landing) { $args['fallback'] = 'hb_banner_slider'; } elseif (is_single() && 'post' == get_post_type() || is_page()) { $args['title'] = get_the_title(); $subtitle = get_post_meta(get_the_ID(), 'subtitle', true); if ($subtitle) { $args['subtitle'] = $subtitle; } $args['over_content'] = true; // elseif ( is_category() ) : // $args['title'] = hb_get_the_archive_title(); // $args['subtitle'] = get_the_archive_description(); // $args['fallback'] = 'hb_banner_category'; // $args['over_content'] = true; } elseif (is_archive()) { //$args['title'] = hb_get_the_archive_title(); $args['subtitle'] = get_the_archive_description(); $args['over_content'] = true; } elseif (is_search()) { $args['title'] = __('Search Results for:', HB_DOMAIN_TXT); $args['subtitle'] = get_search_query(); $args['over_content'] = true; } elseif (is_404()) { $args['title'] = __('Oops! That page can’t be found.', HB_DOMAIN_TXT); $args['subtitle'] = __('It looks like nothing was found at this location. Maybe try a search?', HB_DOMAIN_TXT); $args['over_content'] = true; } else { // huh?! } extract($args); ?> <div id="hero-banner" class="<?php echo str_replace('_', '-', $fallback); ?> "> <?php do_action($fallback); ?> <?php if ($over_content) { ?> <div id="hero-wrapper" class="vertical-align"> <div id="hero-content" class="vertical-box"> <?php if ($title) { ?> <h1 class="entry-title"><span><?php echo $title; ?> </span></h1> <?php } ?> <?php if ($subtitle) { ?> <div class="entry-subtitle h3"><?php echo $subtitle; ?> </div> <?php } ?> </div> </div> <?php } ?> </div> <?php }
$content_url = get_theme_mod('mbdmaster_workshop_archive_content', ''); } } elseif (is_post_type_archive('interview')) { if (get_theme_mod('mbdmaster_interview_archive_content', '')) { $content_url = get_theme_mod('mbdmaster_interview_archive_content', ''); } } elseif (is_post_type_archive('award')) { if (get_theme_mod('mbdmaster_award_archive_content', '')) { $content_url = get_theme_mod('mbdmaster_award_archive_content', ''); } } elseif (is_post_type_archive('film')) { if (get_theme_mod('mbdmaster_film_archive_content', '')) { $content_url = get_theme_mod('mbdmaster_film_archive_content', ''); } } else { $content_url = get_the_archive_description(); } if ($content_url) { echo '<p class="intro h4">' . $content_url . '</p>'; } ?> </div><!-- .container --> </div><!-- #intro .section --> <?php if (have_posts()) { ?> <div id="posts-grid-layout" class="section non-featured-posts"> <div class="container"> <div class="media-object-container masonrycontainer"> <div class="grid-sizer"></div>
/* Translators: %s is the search query. The HTML entities are opening and closing curly quotes. */ $chuchadon_archive_title = sprintf(__('Search results for “%s”', 'chuchadon'), get_search_query()); $chuchadon_loop_desc = sprintf(__('You are browsing the search results for “%s”', 'chuchadon'), get_search_query()); } elseif (is_author()) { $chuchadon_archive_title = get_the_archive_title(); $chuchadon_loop_desc = get_the_author_meta('description', get_query_var('author')); } elseif (is_post_type_archive('jetpack-testimonial')) { $jetpack_options = get_theme_mod('jetpack_testimonials'); $chuchadon_archive_title = $jetpack_options['page-title'] ? esc_html($jetpack_options['page-title']) : esc_html__('Testimonials', 'chuchadon'); $chuchadon_loop_desc = convert_chars(convert_smilies(wptexturize(stripslashes(wp_filter_post_kses(addslashes($jetpack_options['page-content'])))))); } elseif (is_post_type_archive('jetpack-portfolio')) { $chuchadon_archive_title = get_theme_mod('portfolio_title') ? esc_html(get_theme_mod('portfolio_title')) : esc_html__('Portfolio', 'chuchadon'); $chuchadon_loop_desc = get_theme_mod('portfolio_description') ? esc_html(get_theme_mod('portfolio_description')) : esc_html__('Check out our latest work', 'chuchadon'); } else { $chuchadon_archive_title = get_the_archive_title(); $chuchadon_loop_desc = get_the_archive_description(); } ?> <h1 class="site-title loop-title" <?php hybrid_attr('loop-title'); ?> ><?php echo $chuchadon_archive_title; ?> </h1> <?php if ($chuchadon_loop_desc) { ?>