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; }
/** * 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; }
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; }
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; }
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()); } }
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; }
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); }
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; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @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); }
/** * 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; }
/** *存档页信息 *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 }
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. } }
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; } } }
/** * 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; }
/** * 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; }
/** * Return the title for the page depending on the context of the request * * @return string */ function cc_page_title() { if (is_search()) { $page_title = sprintf(__('Search Results: “%s”', 'cart66'), get_search_query()); if (get_query_var('paged')) { $page_title .= sprintf(__(' – Page %s', 'cart66'), get_query_var('paged')); } } elseif (is_tax()) { $page_title = single_term_title("", false); } else { $page_title = CC_Admin_Setting::get_option('cart66_post_type_settings', 'shop_name', 'Shop'); } $page_title = apply_filters('cc_page_title', $page_title); return $page_title; }
function ro_theme_page_title() { ob_start(); if (is_home()) { _e('Home', 'robusta'); } elseif (is_search()) { _e('Search Keyword: ', 'robusta') . '<span class="keywork">' . get_search_query(false) . '</span>'; } elseif (!is_archive()) { the_title(); } else { if (is_category()) { single_cat_title(); } elseif (get_post_type() == 'recipe' || get_post_type() == 'portfolio' || get_post_type() == 'produce' || get_post_type() == 'team' || get_post_type() == 'testimonial' || get_post_type() == 'myclients' || get_post_type() == 'product') { single_term_title(); } elseif (is_tag()) { single_tag_title(); } elseif (is_author()) { printf(__('Author: %s', 'robusta'), '<span class="vcard">' . get_the_author() . '</span>'); } elseif (is_day()) { printf(__('Day: %s', 'robusta'), '<span>' . get_the_date() . '</span>'); } elseif (is_month()) { printf(__('Month: %s', 'robusta'), '<span>' . get_the_date() . '</span>'); } elseif (is_year()) { printf(__('Year: %s', 'robusta'), '<span>' . get_the_date() . '</span>'); } elseif (is_tax('post_format', 'post-format-aside')) { _e('Asides', 'robusta'); } elseif (is_tax('post_format', 'post-format-gallery')) { _e('Galleries', 'robusta'); } elseif (is_tax('post_format', 'post-format-image')) { _e('Images', 'robusta'); } elseif (is_tax('post_format', 'post-format-video')) { _e('Videos', 'robusta'); } elseif (is_tax('post_format', 'post-format-quote')) { _e('Quotes', 'robusta'); } elseif (is_tax('post_format', 'post-format-link')) { _e('Links', 'robusta'); } elseif (is_tax('post_format', 'post-format-status')) { _e('Statuses', 'robusta'); } elseif (is_tax('post_format', 'post-format-audio')) { _e('Audios', 'robusta'); } elseif (is_tax('post_format', 'post-format-chat')) { _e('Chats', 'robusta'); } else { _e('Archives', 'robusta'); } } return ob_get_clean(); }
/** * Filters the `wp_title` output early. * * @since 0.9.0 * @access publc * @param string $title * @param string $separator * @param string $seplocation * @return string */ function omega_wp_title($title, $separator, $seplocation) { if (is_front_page()) { $doctitle = get_bloginfo('name') . $separator . ' ' . get_bloginfo('description'); } elseif (is_home() || is_singular()) { $doctitle = single_post_title('', false); } elseif (is_category()) { $doctitle = single_cat_title('', false); } elseif (is_tag()) { $doctitle = single_tag_title('', false); } elseif (is_tax()) { $doctitle = single_term_title('', false); } elseif (is_post_type_archive()) { $doctitle = post_type_archive_title('', false); } elseif (is_author()) { $doctitle = get_the_author_meta('display_name', get_query_var('author')); } elseif (get_query_var('minute') && get_query_var('hour')) { $doctitle = omega_single_minute_hour_title('', false); } elseif (get_query_var('minute')) { $doctitle = omega_single_minute_title('', false); } elseif (get_query_var('hour')) { $doctitle = omega_single_hour_title('', false); } elseif (is_day()) { $doctitle = omega_single_day_title('', false); } elseif (get_query_var('w')) { $doctitle = omega_single_week_title('', false); } elseif (is_month()) { $doctitle = single_month_title(' ', false); } elseif (is_year()) { $doctitle = omega_single_year_title('', false); } elseif (is_archive()) { $doctitle = omega_single_archive_title('', false); } elseif (is_search()) { $doctitle = omega_search_title('', false); } elseif (is_404()) { $doctitle = omega_404_title('', false); } else { $doctitle = ''; } /* If the current page is a paged page. */ if ((($page = get_query_var('paged')) || ($page = get_query_var('page'))) && $page > 1) { /* Translators: 1 is the page title. 2 is the page number. */ $doctitle = sprintf(__('%1$s Page %2$s', 'omega'), $doctitle . $separator, number_format_i18n(absint($page))); } /* Trim separator + space from beginning and end. */ $doctitle = trim($doctitle, "{$separator} "); return $doctitle; }
/** * Custom template tags for this theme. * * If the function is called directly in the theme or via * another function, it is wrapped to check if a child theme has * redefined it. Otherwise a child theme can unhook what is being attached. * * @package Marketify */ function marketify_downloads_section_title() { if (is_page_template('page-templates/popular.php')) { $cat = get_term(get_query_var('popular_cat'), 'download_category'); if (is_wp_error($cat)) { $base = ''; } else { $base = $cat->name; } printf(__('Popular %s', 'marketify'), $base); } else { $base = is_tax() ? single_term_title('', false) : edd_get_label_plural(); $order = get_query_var('m-orderby') ? sprintf(' ' . __('by %s', 'marketify'), marketify_edd_sorting_options(get_query_var('m-orderby'))) : ''; printf(__('All %s%s', 'marketify'), $base, $order); } }
function recipe_hero_archive_tax_title() { if (is_tax('cuisine')) { $cuisine_text = apply_filters('rh_label_cuisine', __('Cuisine', 'recipe-hero')); echo '<div class="recipe-archive-tax-header">'; echo '<h1 class="archive-title">'; echo single_term_title($cuisine_text . ': '); echo '</h1>'; } elseif (is_tax('course')) { $course_text = apply_filters('rh_label_course', __('Course', 'recipe-hero')); echo '<div class="recipe-archive-tax-header">'; echo '<h1 class="archive-title">'; echo single_term_title($course_text . ': '); echo '</h1>'; } else { } }
/** * woocommerce_page_title function. * * @access public * @return void */ function get_woocommerce_page_title() { if (is_search()) { $page_title = sprintf(__('Search Results: “%s”', 'woocommerce'), get_search_query()); if (get_query_var('paged')) { $page_title .= sprintf(__(' – Page %s', 'woocommerce'), get_query_var('paged')); } } elseif (is_tax()) { $page_title = single_term_title("", false); } elseif (is_single()) { $page_title = get_the_title(); } else { $shop_page_id = woocommerce_get_page_id('shop'); $page_title = get_the_title($shop_page_id); } return apply_filters('woocommerce_page_title', $page_title); }
function set_wp_title($title, $sep, $seplocation) { // use site name if on front+posts page if (is_front_page() && is_home()) { return get_bloginfo(); } elseif (is_front_page()) { global $post; return $post->post_title; } elseif (is_tax()) { $term_title = single_term_title('', false); $tax = get_taxonomy(get_query_var('taxonomy')); $title = $term_title . ' - ' . $tax->labels->singular_name; return $title . ' | ' . get_bloginfo(); } else { return $title . ' | ' . get_bloginfo(); } }
/** * Set meta description based on template. */ function seo_description() { if (get_post_type(array('post', 'page', 'product'))) { $description = get_post_meta(get_the_ID(), '_fathom_seo_description', true); if ($description == '') { $description = get_excerpt_by_id(get_the_ID()); } } elseif (is_product_category()) { global $wp_query; $cat_id = $wp_query->get_queried_object_id(); $description = single_term_title() . ' - ' . strip_tags(term_description($cat_id, 'product_cat')); } // fallback if (!isset($description) || $description == '') { $description = get_bloginfo('description'); } return esc_attr($description); }
/** * woocommerce_page_title function. * * @param boolean $echo * @return string */ function ro_woocommerce_page_title() { if (is_search()) { $page_title = sprintf(__('Search Results: “%s”', 'woocommerce'), get_search_query()); if (get_query_var('paged')) { $page_title .= sprintf(__(' – Page %s', 'woocommerce'), get_query_var('paged')); } } elseif (is_tax()) { $page_title = single_term_title("", false); } elseif (is_archive()) { $page_title = __('Archives Products', 'woocommerce'); } elseif (is_single()) { $page_title = __('Single Product', 'woocommerce'); } else { $shop_page_id = wc_get_page_id('shop'); $page_title = get_the_title($shop_page_id); } return $page_title; }
function output($options) { global $dslc_active; $post_id = $options['post_id']; if (is_singular()) { $post_id = get_the_ID(); } $this->module_start($options); /* Module output starts here */ if (is_category()) { $title = single_cat_title('', false); } elseif (is_tag()) { $title = single_tag_title('', false); } elseif (is_author()) { $title = get_the_author(); } elseif (is_year()) { $title = get_the_date('Y'); } elseif (is_month()) { $title = get_the_date('F Y'); } elseif (is_day()) { $title = get_the_date('F j, Y'); } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); } elseif (is_tax()) { $tax = get_taxonomy(get_queried_object()->taxonomy); $title = $tax->labels->singular_name . ' ' . single_term_title('', false); } elseif (is_search()) { $title = get_the_title($post_id) . ' ' . get_search_query(); } else { $title = get_the_title($post_id); } ?> <div class="dslc-tp-title"><h1><?php echo $title; ?> </h1></div> <?php /* Module output ends here */ $this->module_end($options); }
/** * Filters `get_the_archve_title` to add better archive titles than core. * * @since 1.0.0 * * @param string $title * @return string */ function munsa_lite_archive_title_filter($title) { if (is_home() && !is_front_page()) { $title = get_post_field('post_title', get_queried_object_id()); } elseif (is_category()) { $title = single_cat_title('', false); } elseif (is_tag()) { $title = single_tag_title('', false); } elseif (is_tax()) { $title = single_term_title('', false); } elseif (is_author()) { $title = get_the_author_meta('display_name', absint(get_query_var('author'))); } elseif (is_search()) { $title = sprintf(esc_html__('Search results for “%s”', 'munsa-lite'), get_search_query()); } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); } elseif (is_month()) { $title = single_month_title(' ', false); } return apply_filters('munsa_lite_archive_title', $title); }
function presscore_get_page_title() { $title = ''; if (is_page() || is_single()) { $title = get_the_title(); } else { if (is_search()) { $title = sprintf(_x('Search Results for: %s', 'archive template title', 'the7mk2'), '<span>' . get_search_query() . '</span>'); } else { if (is_archive()) { if (is_category()) { $title = sprintf(_x('Category Archives: %s', 'archive template title', 'the7mk2'), '<span>' . single_cat_title('', false) . '</span>'); } elseif (is_tag()) { $title = sprintf(_x('Tag Archives: %s', 'archive template title', 'the7mk2'), '<span>' . single_tag_title('', false) . '</span>'); } elseif (is_author()) { the_post(); $title = sprintf(_x('Author Archives: %s', 'archive template title', 'the7mk2'), '<span class="vcard"><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></span>'); rewind_posts(); } elseif (is_day()) { $title = sprintf(_x('Daily Archives: %s', 'archive template title', 'the7mk2'), '<span>' . get_the_date() . '</span>'); } elseif (is_month()) { $title = sprintf(_x('Monthly Archives: %s', 'archive template title', 'the7mk2'), '<span>' . get_the_date('F Y') . '</span>'); } elseif (is_year()) { $title = sprintf(_x('Yearly Archives: %s', 'archive template title', 'the7mk2'), '<span>' . get_the_date('Y') . '</span>'); } elseif (is_tax('dt_portfolio_category')) { $title = sprintf(_x('Portfolio Archives: %s', 'archive template title', 'the7mk2'), '<span>' . single_term_title('', false) . '</span>'); } elseif (is_tax('dt_gallery_category')) { $title = sprintf(_x('Albums Archives: %s', 'archive template title', 'the7mk2'), '<span>' . single_term_title('', false) . '</span>'); } else { $title = _x('Archives:', 'archive template title', 'the7mk2'); } } elseif (is_404()) { $title = _x('Page not found', 'index title', 'the7mk2'); } else { $title = _x('Blog', 'index title', 'the7mk2'); } } } return apply_filters('presscore_get_page_title', $title); }
/** * Filters the archive title * * @param string $title The previous archive title. * * @return string */ public function filter_archive_title($title) { if (is_home()) { if (is_front_page()) { $title = __('Blog', 'yoastcom'); } else { $title = get_the_title(get_option('page_for_posts')); } } if (is_category() || is_tag() || is_tax()) { $title = single_term_title('', false); } if (is_post_type_archive('yoast_dev_article')) { $title = __('Dev Blog', 'yoastcom'); } if (is_search()) { $title = sprintf(__('Search for "%s"', 'yoastcom'), get_search_query()); } if (is_author()) { $title = get_the_author(); } return $title; }
/** * fb_opengraph * */ public static function fb_opengraph() { $post = new \TimberPost(); $img = has_post_thumbnail($post->ID) ? wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large')[0] : (get_theme_mod('og_img') ? get_theme_mod('og_img') : esc_url(get_theme_mod('logo'))); $type = is_author() ? 'profile' : (is_single() ? 'article' : 'website'); $description = Site::meta_description(); if (is_tax()) { $url = get_term_link(get_query_var('term'), get_query_var('taxonomy')); $title = single_term_title('', false); } elseif (is_post_type_archive()) { $url = get_post_type_archive_link(get_query_var('post_type')); $title = get_the_archive_title(); } else { $url = get_permalink(); $title = get_the_title(); } $url = rtrim(esc_url(apply_filters('og_url', $url))); if (!substr($url, -1) === '/') { $url .= '/'; // slash fixes Facebook Debugger "Circular Redirect Path" } $open_graph = array('site_name' => esc_attr(apply_filters('og_site_name', get_bloginfo())), 'title' => esc_attr(apply_filters('og_title', $title)), 'description' => esc_attr(wp_strip_all_tags(apply_filters('og_description', $description))), 'type' => esc_attr(apply_filters('og_type', $type)), 'url' => $url, 'image' => esc_url(apply_filters('og_image', $img))); \Timber::render('open-graph.twig', array('open_graph' => $open_graph)); }
/** * Gets the loop title. This function should only be used on archive-type pages, such as archive, blog, and * search results pages. It outputs the title of the page. * * @link http://core.trac.wordpress.org/ticket/21995 * @since 1.2.0 * @access public * @return string */ function bon_get_loop_title() { $loop_title = ''; if (is_home() && !is_front_page()) { $loop_title = get_post_field('post_title', get_queried_object_id()); } elseif (is_category()) { $loop_title = single_cat_title('', false); } elseif (is_tag()) { $loop_title = single_tag_title('', false); } elseif (is_tax()) { $loop_title = single_term_title('', false); } elseif (is_author()) { $loop_title = get_the_author(); } elseif (is_search()) { $loop_title = bon_search_title('', false); } elseif (is_post_type_archive()) { $loop_title = post_type_archive_title('', false); } elseif (get_query_var('minute') && get_query_var('hour')) { $loop_title = bon_single_minute_hour_title('', false); } elseif (get_query_var('minute')) { $loop_title = bon_single_minute_title('', false); } elseif (get_query_var('hour')) { $loop_title = bon_single_hour_title('', false); } elseif (is_day()) { $loop_title = bon_single_day_title('', false); } elseif (get_query_var('w')) { $loop_title = bon_single_week_title('', false); } elseif (is_month()) { $loop_title = single_month_title(' ', false); } elseif (is_year()) { $loop_title = bon_single_year_title('', false); } elseif (is_archive()) { $loop_title = bon_single_archive_title('', false); } return apply_filters('bon_loop_title', $loop_title); }