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; }
function title() { if (is_category()) { echo 'Category Archive for "'; single_cat_title(); echo '" | '; bloginfo('name'); } elseif (is_tag()) { echo 'Tag Archive for "'; single_tag_title(); echo '" | '; bloginfo('name'); } elseif (is_archive()) { wp_title(''); echo ' Archive | '; bloginfo('name'); } elseif (is_search()) { echo 'Search for "' . wp_specialchars($s) . '" | '; bloginfo('name'); } elseif (is_home() || is_front_page()) { bloginfo('name'); echo ' | '; bloginfo('description'); } elseif (is_404()) { echo 'Error 404 Not Found | '; bloginfo('name'); } elseif (is_single()) { wp_title(''); } else { echo wp_title(' | ', false, right); bloginfo('name'); } }
function theme_description() { global $s, $post; $description = ''; $blog_name = get_bloginfo('name'); if (is_singular()) { if (!empty($post->post_excerpt)) { $text = $post->post_excerpt; } else { $text = $post->post_content; } $description = trim(str_replace(array("\r\n", "\r", "\n", " ", " "), " ", str_replace("\"", "'", strip_tags($text)))); if (!$description) { $description = $blog_name . "-" . trim(wp_title('', false)); } } elseif (is_home()) { $description = $blog_name . "-" . get_bloginfo('description') . '|' . dopt('Rcloud_description'); // 首頁要自己加 } elseif (is_tag()) { $description = $blog_name . "有关 '" . single_tag_title('', false) . "' 的文章"; } elseif (is_category()) { $description = $blog_name . "有关 '" . single_cat_title('', false) . "' 的文章"; } elseif (is_archive()) { $description = $blog_name . "在: '" . trim(wp_title('', false)) . "' 的文章"; } elseif (is_search()) { $description = $blog_name . ": '" . esc_html($s, 1) . "' 的搜索結果"; } else { $description = $blog_name . "有关 '" . trim(wp_title('', false)) . "' 的文章"; } $description = mb_substr($description, 0, 220, 'utf-8') . '..'; echo "<meta name=\"description\" content=\"{$description}\" />\n"; }
function crumb() { if (is_attachment()) { $titles = $title = '附件'; } elseif (is_single()) { $categorys = get_the_category(); $category = $categorys[0]; $title = get_the_title(); $titles = get_category_parents($category->term_id, true, ' » ') . $title; } elseif (is_page()) { $titles = $title = get_the_title(); } elseif (is_category()) { $titles = $title = single_cat_title('', false); } elseif (is_tag()) { $titles = $title = single_tag_title('', false); } elseif (is_day()) { $titles = $title = get_the_time('Y年Fj日'); } elseif (is_month()) { $titles = $title = get_the_time('Y年F'); } elseif (is_year()) { $titles = $title = get_the_time('Y年'); } elseif (is_search()) { global $s; $titles = $title = $s . ' 的搜索结果'; } else { $titles = $title = ''; } echo '<div class="crumb">' . ' <strong style="display:inline;">' . $title . '</strong>' . ' <div class="nav_crumb">' . ' <a href="' . get_bloginfo('url') . '" title="' . get_bloginfo('name') . '">HOME</a> » ' . $titles . ' </div>' . '</div>'; }
/** * Handle output of page title */ function boilerplate_title($post = null) { $queried_object = get_queried_object(); if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Latest Posts', 'boilerplate'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term && get_query_var('taxonomy') !== 'language') { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', @$queried_object->labels->name ?: $queried_object->post_title); } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'boilerplate'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'boilerplate'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'boilerplate'), get_the_date('Y')); } elseif (is_author()) { $author = $queried_object; return sprintf(__('Author Archives: %s', 'boilerplate'), apply_filters('the_author', is_object($author) ? $author->display_name : null)); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for “%s”', 'boilerplate'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'boilerplate'); } else { return get_the_title(); } }
function smarty_single_cat_title($params) { $display = ''; $prefix = ''; extract($params); return single_cat_title($prefix, $display); }
/** * Page titles */ function dw_timeline_title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return get_bloginfo('name'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'dw-timeline'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'dw-timeline'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'dw-timeline'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Author Archives: %s', 'dw-timeline'), $author->display_name); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'dw-timeline'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'dw-timeline'); } else { return get_the_title(); } }
function mh_page_title() { if (is_home()) { echo get_the_title(get_option('page_for_posts', true)); } elseif (is_author()) { global $author; $user_info = get_userdata($author); echo __('Articles by ', 'mh') . esc_attr($user_info->display_name); } elseif (is_category() || is_tax()) { echo single_cat_title("", false); } elseif (is_tag()) { echo single_tag_title("", false); } elseif (is_search()) { echo __('Search Results for ', 'mh') . get_search_query(); } elseif (is_day()) { echo get_the_date(); } elseif (is_month()) { echo get_the_date('F Y'); } elseif (is_year()) { echo get_the_date('Y'); } elseif (is_404()) { echo __('Page not found (404)', 'mh'); } else { echo get_the_title(); } }
function OnPrePageLoad() { # set page title if (have_posts()) { $post = $posts[0]; // Hack. Set $post so that the_date() works. /* If this is a category archive */ if (is_category()) { $this->title = single_cat_title('', false); $this->SetPageTitle($this->title); } elseif (is_tag()) { $this->title = " tagged with '" . single_tag_title('', false) . "'"; $this->SetPageTitle('Stoolball news ' . $this->title); } elseif (is_day()) { $this->title = "on " . apply_filters('the_time', get_the_time('j F Y'), 'j F Y'); $this->SetPageTitle('Stoolball news ' . $this->title); } elseif (is_month()) { $this->title = 'in ' . apply_filters('the_time', get_the_time('F Y'), 'F Y'); $this->SetPageTitle('Stoolball news ' . $this->title); } elseif (is_year()) { $this->title = 'in ' . apply_filters('the_time', get_the_time('Y'), 'Y'); $this->SetPageTitle('Stoolball news ' . $this->title); } elseif (is_author()) { $this->title = "by author"; $this->SetPageTitle('Stoolball news ' . $this->title); } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { $this->SetPageTitle('Stoolball news'); } } $this->SetOpenGraphType("blog"); $this->SetContentConstraint($this->ConstrainColumns()); $this->SetContentCssClass('hasLargeImage'); }
function reactor_category_submenu($args = '') { $defaults = array('taxonomy' => 'category', 'all_link' => __('All', 'reactor'), 'quicksand' => false, 'terms_args' => ''); $args = wp_parse_args($args, $defaults); $count = 0; $terms = get_terms($args['taxonomy'], $args['terms_args']) ? get_terms($args['taxonomy'], $args['terms_args']) : ''; $count = count($terms); if ($count > 1) { $filter_class = $args['quicksand'] ? ' filter-nav' : ''; $output = '<div class="category-submenu"><dl class="sub-nav' . $filter_class . '"><dt>' . __('Categories: ', 'reactor') . '</dt>'; if ($args['quicksand']) { $output .= '<div class="category-submenu"><dd class="filter active" data-filter="all"><a>' . $args['all_link'] . '</a></dd>'; } $current_category = single_cat_title('', false); $i = 2; foreach ($terms as $term) { $active = $term->name == $current_category ? 'active' : ''; if ($args['quicksand']) { $output .= '<dd class="filter" data-filter="' . $term->slug . '"><a>' . $term->name . '</a></dd>'; } else { $output .= '<dd class="' . $active . '"><a href="' . get_term_link($term->slug, $args['taxonomy']) . '">' . $term->name . '</a></dd>'; } $i++; } $output .= '</dl></div>'; echo apply_filters('reactor_category_submenu', $output, $args); } }
/** * Page titles */ function roots_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', 'roots'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('<span>Daily Archives:</span> %s', 'roots'), get_the_date()); } elseif (is_month()) { return sprintf(__('<span>Monthly Archives:</span> %s', 'roots'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('<span>Yearly Archives:</span> %s', 'roots'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('<span>Author Archives:</span> %s', 'roots'), $author->display_name); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('<span>Search Results for</span> "%s"', 'roots'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'roots'); } else { return get_the_title(); } }
function title() { global $thesis_site, $thesis_pages; $site_name = get_bloginfo('name'); #wp $separator = $thesis_site->head['title']['separator'] ? urldecode($thesis_site->head['title']['separator']) : '—'; if (is_home() || is_front_page()) { #wp $tagline = get_bloginfo('description'); #wp $home_title = $thesis_pages->home['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->home['head']['title']))) : "{$site_name} {$separator} {$tagline}"; #wp if (get_option('show_on_front') == 'page' && is_front_page()) { #wp $page_title = get_post_meta(get_option('page_on_front'), 'thesis_title', true); } elseif (get_option('show_on_front') == 'page' && is_home()) { #wp $page_title = get_post_meta(get_option('page_for_posts'), 'thesis_title', true); } #wp $output = $page_title ? trim(wptexturize(strip_tags(stripslashes($page_title)))) : $home_title; #wp } elseif (is_category()) { #wp global $wp_query; #wp $category_title = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title']))) : single_cat_title('', false); #wp $output = $thesis_site->head['title']['branded'] ? "{$category_title} {$separator} {$site_name}" : $category_title; } elseif (is_tag()) { global $wp_query; #wp $tag_title = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title']))) : single_tag_title('', false); #wp $output = $thesis_site->head['title']['branded'] ? "{$tag_title} {$separator} {$site_name}" : $tag_title; } elseif (is_search()) { #wp $search_title = __('You searched for', 'thesis') . ' “' . attribute_escape(get_search_query()) . '”'; #wp $output = $thesis_site->head['title']['branded'] ? "{$search_title} {$separator} {$site_name}" : $search_title; } else { global $post; #wp $custom_title = is_single() || is_page() ? trim(wptexturize(strip_tags(stripslashes(get_post_meta($post->ID, 'thesis_title', true))))) : false; #wp $page_title = $custom_title ? $custom_title : trim(wp_title('', false)); #wp $output = $thesis_site->head['title']['branded'] ? "{$page_title} {$separator} {$site_name}" : $page_title; } if (is_home() || is_archive() || is_search()) { #wp $current_page = get_query_var('paged'); #wp if ($current_page > 1) { $output .= " {$separator} " . __('Page', 'thesis') . " {$current_page}"; } } $this->title['title'] = '<title>' . apply_filters('thesis_title', $output, $separator) . '</title>'; #wp #filter }
/** * Page titles */ function ungarh_title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Senaste inläggen', 'ungarh'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('Dagligt Arkiv: %s', 'ungarh'), get_the_date()); } elseif (is_month()) { return sprintf(__('Arkiv för månad: %s', 'ungarh'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Årligt arkiv: %s', 'ungarh'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Arkiv för personer: %s', 'ungarh'), apply_filters('the_author', is_object($author) ? $author->display_name : null)); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Sökresultat för: %s', 'ungarh'), get_search_query()); } elseif (is_404()) { return __('Sidan finns inte', 'ungarh'); } else { return get_the_title(); } }
function or_page_title() { $post = $posts[0]; // Hack. Set $post so that the_date() works. /* If this is a category archive */ if (is_category()) { $title = '<h3 class="pagetitle">' . __('Archive for the ‘') . single_cat_title("", false) . __('’ Category') . '</h3>'; /* If this is a tag archive */ } elseif (is_tag()) { $title = '<h3 class="pagetitle">' . __('Posts Tagged ‘') . single_tag_title("", false) . __('’') . '</h3>'; /* If this is a daily archive */ } elseif (is_day()) { $title = '<h3 class="pagetitle">' . __('Archive for ') . get_the_time('F jS, Y') . '</h3>'; /* If this is a monthly archive */ } elseif (is_month()) { $title = '<h3 class="pagetitle">' . __('Archive for ') . get_the_time('F, Y') . '</h3>'; /* If this is a yearly archive */ } elseif (is_year()) { $title = '<h3 class="pagetitle">' . __('Archive for ') . get_the_time('Y') . '</h3>'; /* If this is an author archive */ } elseif (is_author()) { $title = '<h3 class="pagetitle">' . __('Author Archive') . '</h3>'; /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { $title = '<h3 class="pagetitle">' . __('Blog Archives') . '</h3>'; } elseif (is_search()) { $title = '<h3>' . __('Search Results for "') . get_search_query() . __('"') . '</h3>'; } echo apply_filters('or_page_title', $title); }
/** * Page titles */ function ya_title() { if (is_home()) { if (get_option('page_for_posts', true)) { echo get_the_title(get_option('page_for_posts', true)); } else { _e('Latest Posts', 'yatheme'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { echo $term->name; } elseif (is_post_type_archive()) { echo get_queried_object()->labels->name; } elseif (is_day()) { printf(__('Daily Archives: %s', 'yatheme'), get_the_date()); } elseif (is_month()) { printf(__('Monthly Archives: %s', 'yatheme'), get_the_date('F Y')); } elseif (is_year()) { printf(__('Yearly Archives: %s', 'yatheme'), get_the_date('Y')); } elseif (is_author()) { printf(__('Author Archives: %s', 'yatheme'), get_the_author()); } else { single_cat_title(); } } elseif (is_search()) { printf(__('Search Results for <small>%s</small>', 'yatheme'), get_search_query()); } elseif (is_404()) { _e('Not Found', 'yatheme'); } else { the_title(); } }
function warrior_archive_title() { global $wp_query; $title = ''; if (is_category()) { $title = sprintf(__('%s <span>Category Archives</span>', 'familia'), single_cat_title('', false)); } elseif (is_tag()) { $title = sprintf(__('%s <span>Tag Archives</span>', 'familia'), single_tag_title('', false)); } elseif (get_post_format()) { $title = sprintf(__('Post Format: %s', 'familia'), get_post_format_string(get_post_format())); } elseif (is_day()) { $title = sprintf(__('%s <span>Daily Archives</span>', 'familia'), date_i18n('d', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_month()) { $title = sprintf(__('%s <span>Monthly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_year()) { $title = sprintf(__('%s <span>Yearly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false))); } elseif (is_author()) { $author = get_user_by('slug', get_query_var('author_name')); $title = sprintf(__('%s <span>Author Archives</span>', 'familia'), get_the_author_meta('display_name', $author->ID)); } elseif (is_search()) { if ($wp_query->found_posts) { $title = sprintf(__('Search Results for: "%s"', 'familia'), esc_attr(get_search_query())); } else { $title = sprintf(__('No Results for: "%s"', 'familia'), esc_attr(get_search_query())); } } elseif (is_404()) { $title = __('Not Found', 'familia'); } elseif (is_home() || is_front_page() || is_single()) { $title = ''; } else { $title = __('Blog', 'familia'); } return $title; }
function wptouch_theme_archive_text() { if (!is_home()) { echo '<div class="archive-text">'; } if (is_search()) { echo sprintf(__("Search results › %s", "wptouch-pro"), get_search_query()); } if (is_category()) { echo sprintf(__("Categories › %s", "wptouch-pro"), single_cat_title("", false)); } elseif (is_tag()) { echo sprintf(__("Tags › %s", "wptouch-pro"), single_tag_title(" ", false)); } elseif (is_day()) { echo sprintf(__("Archives › %s", "wptouch-pro"), get_the_time('F jS, Y')); } elseif (is_month()) { echo sprintf(__("Archives › %s", "wptouch-pro"), get_the_time('F, Y')); } elseif (is_year()) { echo sprintf(__("Archives › %s", "wptouch-pro"), get_the_time('Y')); } elseif (is_404()) { echo __("404 Not Found", "wptouch-pro"); } if (!is_home()) { echo '</div>'; } }
function MBT_keywords() { global $s, $post; $keywords = ''; if (is_single()) { if (get_the_tags($post->ID)) { foreach (get_the_tags($post->ID) as $tag) { $keywords .= $tag->name . ', '; } } foreach (get_the_category($post->ID) as $category) { $keywords .= $category->cat_name . ', '; } $keywords = substr_replace($keywords, '', -2); } elseif (is_home()) { $keywords = get_bloginfo("name"); } elseif (is_tag()) { $keywords = single_tag_title('', false); } elseif (is_category()) { $keywords = single_cat_title('', false); } elseif (is_search()) { $keywords = esc_html($s, 1); } else { $keywords = trim(wp_title('', false)); } if ($keywords) { echo "<meta name=\"keywords\" content=\"{$keywords}\">\n"; } }
function dez_mp_theme_wp_title($title, $sep) { global $paged, $page; $site_title = get_bloginfo('name'); $post_title = the_title_attribute('echo=0'); $site_description = get_bloginfo('description', 'display'); $sep = '»'; if (is_feed()) { $title = $site_title; } elseif ($site_description && (is_home() || is_front_page())) { $title = "{$site_title} {$sep} {$site_description}"; } elseif ($paged >= 2 || $page >= 2) { $title = "{$site_title} {$sep} " . sprintf(__('Page %s', 'mesocolumn'), max($paged, $page)); } elseif (is_category() || is_tag()) { $title = ucfirst(single_cat_title('', false)) . ' ' . $sep . ' ' . $site_title; } elseif (is_singular()) { $title = "{$post_title} {$sep} {$site_title}"; } else { if (is_day()) { $title = __('Archives for ', 'mesocolumn') . get_the_date() . ' ' . $sep . ' ' . $site_title; } else { if (is_month()) { $title = __('Archives for ', 'mesocolumn') . get_the_date('F Y') . ' ' . $sep . ' ' . $site_title; } else { if (is_year()) { $title = __('Archives for ', 'mesocolumn') . get_the_date('Y') . ' ' . $sep . ' ' . $site_title; } } } } return $title; }
/** * Page title used in the content area of each page. Note this is kinda legacy. * Could be replaced with wp_title(). * * @package d7 * @subpackage boilerplate-theme * * @return string The page title * */ function d7_get_page_title() { $title = ''; if (is_category()) { $title .= single_cat_title("", false); } elseif (is_tag()) { $title .= __('Content tagged: ', get_bloginfo('name')) . single_tag_title("", false); } elseif (is_day()) { $title .= __('Archive for ', get_bloginfo('name')) . get_the_time('F jS, Y'); } elseif (is_month()) { $title .= __('Archive for', get_bloginfo('name')) . ' ' . get_the_time('F, Y'); } elseif (is_year()) { $title .= __('Archive for', get_bloginfo('name')) . ' ' . get_the_time('Y'); } elseif (is_search()) { $title .= __('Search results', get_bloginfo('name')); if (isset($_GET['s'])) { $title .= ' ' . __('for', get_bloginfo('name')) . ' <span class="search_term">"' . $_GET['s'] . '"</span>'; } } elseif (is_author()) { $title .= __('Author archive', get_bloginfo('name')); } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { $title .= __('Archives'); } elseif (is_404()) { $title .= __('Oh darn!', get_bloginfo('name')); } else { $title .= bloginfo('name'); } return $title; }
function get_breadcrumbs($post) { echo "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><a href=" . get_bloginfo('url') . " itemprop=\"url\"><span itemprop=\"title\">Home</span></a><span class=arrow> > </span></li>"; if (is_home()) { $breadcrumbs[] = '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . single_post_title($page->ID) . '</span></a><span class=arrow> > </span></li>'; } elseif (is_single() || is_page()) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . get_the_title($page->ID) . '</span></a><span class=arrow> > </span></li>'; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) { echo $crumb; } echo "<li itemscope itemtype=\"http://data-vocabulary.org/Breadcrumb\"><span itemprop=\"title\">" . $post->post_title . "</span></li>"; } elseif (is_category()) { echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="' . get_permalink($page->ID) . '" title="" itemprop="url"><span itemprop="title">' . single_cat_title($page->ID) . '</span></a></li>'; } elseif (is_archive()) { echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">Archives</span></li>'; } elseif (is_404()) { echo '<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">404 Page Not Found</span></li>'; } }
/** * You can use this to output a proper title for your page. This handles special cases such as archive page titles, * taxonomy archives, etc. * * @return string A nice page title */ public static function mainPageTitle() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Latest Posts', 'baobab'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'baobab'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'baobab'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'baobab'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Author Archives: %s', 'baobab'), apply_filters('the_author', is_object($author) ? $author->display_name : null)); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'baobab'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'baobab'); } else { return get_the_title(); } }
/** * Page titles */ function stachestack_title() { if (is_home()) { if (get_option('page_for_posts', true)) { $title = get_the_title(get_option('page_for_posts', true)); } else { $title = __('Latest Posts', 'stachestack'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { $title = apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { $title = apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date()); } elseif (is_month()) { $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y')); } elseif (is_year()) { $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y')); } elseif (is_author()) { $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name); } else { $title = single_cat_title('', false); } } elseif (is_search()) { $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query()); } elseif (is_404()) { $title = __('Not Found', 'stachestack'); } else { $title = get_the_title(); } return apply_filters('stachestack_title', $title); }
function kkthemes_archive_title() { $tag_style = ''; $header_image = get_header_image(); if (!empty($header_image)) { $tag_style = 'background-image: url(' . esc_url($header_image) . ');'; } ?> <div class="uk-panel uk-panel-box uk-panel-space uk-text-large uk-text-center tm-branded-panel uk-margin-large-bottom" style="<?php echo $tag_style; ?> "> <h1 class="uk-article-title" itemprop="headline"> <?php single_cat_title('') || post_type_archive_title(''); ?> </h1> <?php if (is_featured_item()) { $post_type = get_post_type(); echo '<p>' . get_post_type_object($post_type)->description . '</p>'; } else { echo category_description(); } ?> </div> <?php }
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); }
/** * Shim for `sociallyviral_archive_title()`. * * Display the archive title based on the queried object. * * @todo Remove this function when WordPress 4.3 is released. * * @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 sociallyviral_archive_title($before = '', $after = '') { if (is_category()) { $title = sprintf(__('Category: %s', 'sociallyviral'), single_cat_title('', false)); } elseif (is_tag()) { $title = sprintf(__('Tag: %s', 'sociallyviral'), single_tag_title('', false)); } elseif (is_author()) { $title = sprintf(__('Author: %s', 'sociallyviral'), '<span class="vcard">' . get_the_author() . '</span>'); } elseif (is_year()) { $title = sprintf(__('Year: %s', 'sociallyviral'), get_the_date(_x('Y', 'yearly archives date format', 'sociallyviral'))); } elseif (is_month()) { $title = sprintf(__('Month: %s', 'sociallyviral'), get_the_date(_x('F Y', 'monthly archives date format', 'sociallyviral'))); } elseif (is_day()) { $title = sprintf(__('Day: %s', 'sociallyviral'), get_the_date(_x('F j, Y', 'daily archives date format', 'sociallyviral'))); } elseif (is_post_type_archive()) { $title = sprintf(__('Archives: %s', 'sociallyviral'), 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(__('%1$s: %2$s', 'sociallyviral'), $tax->labels->singular_name, single_term_title('', false)); } else { $title = __('Archives', 'sociallyviral'); } /** * 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; } }
/** * Page titles */ function roots_title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Most Recent Posts', 'roots'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return apply_filters('single_term_title', $term->name); } elseif (is_post_type_archive()) { return apply_filters('the_title', get_queried_object()->labels->name); } elseif (is_day()) { return sprintf(__('Old Posts, Organized by Day: %s', 'roots'), get_the_date()); } elseif (is_month()) { return sprintf(__('Old Posts, Organized by Month: %s', 'roots'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Old Posts, Organized by Year: %s', 'roots'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Old Posts, Organized by Author: %s', 'roots'), apply_filters('the_author', is_object($author) ? $author->display_name : null)); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'roots'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'roots'); } else { return get_the_title(); } }
/** * Page titles */ function pinnacle_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', 'pinnacle'); } } elseif (is_archive()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); if ($term) { return $term->name; } elseif (is_post_type_archive()) { return get_queried_object()->labels->name; } elseif (is_day()) { return sprintf(__('Daily Archives: %s', 'pinnacle'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'pinnacle'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'pinnacle'), get_the_date('Y')); } elseif (is_author()) { return sprintf(__('Author Archives: %s', 'pinnacle'), get_the_author()); } else { return single_cat_title("", false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'pinnacle'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'pinnacle'); } else { return get_the_title(); } }
public function addMetaTags() { global $post, $wp, $properties; /* * og: inicial */ $this->properties = array('og:type' => 'article', 'og:url' => home_url($wp->request), 'og:site_name' => get_bloginfo('name'), 'og:locale' => 'pt_BR'); /* * * og:title * Título do "post" que ira aparecer no PopUP do facebook e na Timeline * */ if (is_single()) { $this->properties['og:title'] = get_the_title(); } elseif (is_category()) { $this->properties['og:title'] = single_cat_title('', false); } elseif (is_tag()) { $this->properties['og:title'] = single_tag_title('', false); } else { $this->properties['og:title'] = get_bloginfo('name'); } /* * * og:image * Thumbnail do "post" que ira aparecer no PopUP do facebook e na Timeline * */ if (is_single() && has_post_thumbnail($post->ID)) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); if (!empty($image[0])) { $this->properties['og:image'] = $image[0]; } else { $this->properties['og:image'] = get_stylesheet_directory_uri() . '/img/logo-facebook.png'; } } /* * * og:description * Descrição do "post" se tiver em um ou do site * */ if (is_single() && !empty(get_the_excerpt())) { $this->properties['og:description'] = get_the_excerpt(); } else { $this->properties['og:description'] = get_bloginfo('description'); } /* * Faz um loop de todos os ogs existentes e adiciona ao head do HTML */ foreach ($this->properties as $og => $og_value) { if ($og === 'og:url' or $og === 'og:image') { echo "<meta name=\"{$og}\" content=\"{$og_value}\" />\n"; } else { $og_value = utils::htmlentities($og_value); echo "<meta name=\"{$og}\" content=\"{$og_value}\" />\n"; } } }
function lo_description() { global $s, $post; $description = ''; $blog_name = get_bloginfo('name'); if (is_singular()) { $ID = $post->ID; $title = $post->post_title; $author = $post->post_author; $user_info = get_userdata($author); $post_author = $user_info->display_name; if (!get_post_meta($ID, "meta-description", true)) { $description = $title . ' - 作者: ' . $post_author . ',首发于' . $blog_name; } else { $description = get_post_meta($ID, "meta-description", true); } } elseif (is_home()) { $description = lo_opt('index_description'); } elseif (is_tag()) { $description = single_tag_title('', false) . " - " . trim(strip_tags(tag_description())); } elseif (is_category()) { $description = single_cat_title('', false) . " - " . trim(strip_tags(category_description())); } elseif (is_archive()) { $description = $blog_name . "'" . trim(wp_title('', false)) . "'"; } elseif (is_search()) { $description = $blog_name . ": '" . esc_html($s, 1) . "' 的搜索結果"; } else { $description = $blog_name . "'" . trim(wp_title('', false)) . "'"; } $description = mb_substr($description, 0, 220, 'utf-8'); echo "<meta name=\"description\" content=\"{$description}\">\n"; }