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 }
/** * Change for `the_archive_title()`. * * Display the archive title based on the queried object. */ function get_the_archive_title_callback_wpbss($title) { if (is_post_type_archive()) { return post_type_archive_title('', false); } return $title; }
public static function archive_title() { $title = apply_filters('fp-team-archive-title-text', post_type_archive_title('', false)); echo '<div class="large-12 columns center-text fp-team-title-container">'; echo '<h1>' . $title . '</h1>'; echo '</div>'; }
/** * Return the HTML link of the translation of a post. * * @param $post_id integer id of post. * @param $language string language of translation. If it is null or invalid, current language loaded in the page is used. * @param $label string inner text of the link. * @param $class string text to include as class parameter in the link * * @return string the HTML link of the translation link of a post. */ function uls_get_link($post_id = null, $language = null, $label = null, $class = 'uls-link') { if ($post_id == null) { if (is_home()) { $url = get_home_url(); $translation_url = uls_get_url_translated($url, $language); } else { if (is_archive()) { $url = get_post_type_archive_link(get_post_type()); $translation_url = uls_get_url_translated($url, $language); $title = post_type_archive_title("", false); } } } else { $translation_id = uls_get_post_translation_id($post_id, $language); if (empty($translation_id)) { $translation_id = $post_id; } //set conversion of permalinks to false global $uls_permalink_convertion; $uls_permalink_convertion = false; $translation_url = uls_get_url_translated(get_permalink($translation_id), $language); //set conversion of permalinks to true again $uls_permalink_convertion = true; $title = get_the_title($translation_id); } // echo $translation_url; if (null == $label) { return '<a class="' . $class . '" href="' . $translation_url . '" >' . $title . '</a>'; } else { return '<a class="' . $class . '" href="' . $translation_url . '" >' . $label . '</a>'; } }
function ref_custom_archive_title($title) { if (is_post_type_archive()) { $title = post_type_archive_title('', false); } return $title; }
/** * Output the title * * @return string $title */ function calibrefx_og_title() { global $post, $wp_locale, $wp_query; $title = ''; if (is_home() || is_front_page()) { $title = get_bloginfo('name'); } elseif (is_singular()) { $title = stripslashes(esc_attr($post->post_title)) . ' - ' . get_bloginfo('name'); } elseif (is_archive()) { if (is_category()) { $category = get_term(get_query_var('cat'), 'category'); $title = __('Archive for ', 'calibrefx') . $category->name . ' - ' . get_bloginfo('name'); } elseif (is_tax()) { $term = $wp_query->get_queried_object(); $taxonomy = get_term($term->term_id, $term->taxonomy); $title = __('Archive for ', 'calibrefx') . $taxonomy->name . ' - ' . get_bloginfo('name'); } elseif (is_year()) { $title = __('Archive for ', 'calibrefx') . get_query_var('year') . ' - ' . get_bloginfo('name'); } elseif (is_month()) { $title = __('Archive for ', 'calibrefx') . $wp_locale->get_month(get_query_var('monthnum')) . ' ' . get_query_var('year') . ' - ' . get_bloginfo('name'); } elseif (is_day()) { $title = __('Archive for ', 'calibrefx') . get_query_var('day') . ' ' . $wp_locale->get_month(get_query_var('monthnum')) . ' ' . get_query_var('year') . ' - ' . get_bloginfo('name'); } elseif (is_author()) { $title = __('Archive for ', 'calibrefx') . $wp_query->queried_object->display_name . ' - ' . get_bloginfo('name'); } elseif (is_post_type_archive()) { $title = __('Archive for ', 'calibrefx') . post_type_archive_title('', false) . ' - ' . get_bloginfo('name'); } } elseif (is_404()) { $title = __('Not Found', 'calibrefx') . ' - ' . get_bloginfo('name'); } return apply_filters('calibrefx_og_title', $title); }
/** * Filter the output of the archive title */ function seventeen_filter_archive_title($title) { if (is_post_type_archive('artists')) { $title = post_type_archive_title('', false); } return $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); }
/** * Return the Page title string */ function kleo_title() { $output = ""; if (is_tag()) { $output = __('Tag Archive for:', 'kleo_framework') . " " . single_tag_title('', false); } elseif (is_tax()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $output = $term->name; } elseif (is_category()) { // Remove Archive for Category: as per Lloyd request // $output = __('Archive for category:', 'kleo_framework') . " " . single_cat_title('', false); $output = single_cat_title('', false); } elseif (is_day()) { $output = __('Archive for date:', 'kleo_framework') . " " . get_the_time('F jS, Y'); } elseif (is_month()) { $output = __('Archive for month:', 'kleo_framework') . " " . get_the_time('F, Y'); } elseif (is_year()) { $output = __('Archive for year:', 'kleo_framework') . " " . get_the_time('Y'); } elseif (is_author()) { $curauth = get_query_var('author_name') ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); $output = __('Author Archive', 'kleo_framework') . " "; if (isset($curauth->nickname)) { $output .= __('for:', 'kleo_framework') . " " . $curauth->nickname; } } elseif (is_archive()) { $output = post_type_archive_title('', false); } elseif (is_search()) { global $wp_query; if (!empty($wp_query->found_posts)) { if ($wp_query->found_posts > 1) { $output = $wp_query->found_posts . " " . __('search results for:', 'kleo_framework') . " " . esc_attr(get_search_query()); } else { $output = $wp_query->found_posts . " " . __('search result for:', 'kleo_framework') . " " . esc_attr(get_search_query()); } } else { if (!empty($_GET['s'])) { $output = __('Search results for:', 'kleo_framework') . " " . esc_attr(get_search_query()); } else { $output = __('To search the site please enter a valid term', 'kleo_framework'); } } } elseif (is_front_page() && !is_home()) { $output = get_the_title(get_option('page_on_front')); } elseif (is_home()) { if (get_option('page_for_posts')) { $output = get_the_title(get_option('page_for_posts')); } else { $output = __('Blog', 'kleo_framework'); } } elseif (is_404()) { $output = __('Error 404 - Page not found', 'kleo_framework'); } else { $output = get_the_title(); } if (isset($_GET['paged']) && !empty($_GET['paged'])) { $output .= " (" . __('Page', 'kleo_framework') . " " . $_GET['paged'] . ")"; } return $output; }
/** * Filter the archive title.. * * @param string $title Archive title to be displayed. * @return string */ function jawsdays_get_the_archive_title($title) { if (is_category()) { $title = single_cat_title('', false); } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); } return $title; }
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 setup() { global $redux_demo; $options = $redux_demo; add_theme_support('soil-clean-up'); // Enable clean up from Soil add_theme_support('soil-relative-urls'); // Enable relative URLs from Soil add_theme_support('soil-nice-search'); // Enable nice search from Soil add_theme_support('soil-google-analytics', $options['google-analytics-id']); // Enable Google Analytics //add_theme_support('soil-jquery-cdn'); // Enable jQuery from the Google CDN //add_theme_support('soil-js-to-footer'); // Enable js to footer add_theme_support('soil-nav-walker'); // Enable clean nav walker add_theme_support('bootstrap-gallery'); // Enable Bootstrap Gallery // Make theme available for translation // Community translations can be found at https://github.com/roots/sage-translations load_theme_textdomain('sage', get_template_directory() . '/lang'); // Enable plugins to manage the document title // http://codex.wordpress.org/Function_Reference/add_theme_support#Title_Tag add_theme_support('title-tag'); // Register wp_nav_menu() menus // http://codex.wordpress.org/Function_Reference/register_nav_menus register_nav_menus(['primary_navigation' => __('Primary Navigation', 'sage')]); // Add post thumbnails // http://codex.wordpress.org/Post_Thumbnails // http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size // http://codex.wordpress.org/Function_Reference/add_image_size add_theme_support('post-thumbnails'); //update_option( 'medium_crop', 1 ); //Turn on image crop at medium size // Add post formats // http://codex.wordpress.org/Post_Formats //add_theme_support('post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio']); // Add HTML5 markup for captions // http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5 add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']); // Tell the TinyMCE editor to use a custom stylesheet add_editor_style(Assets\asset_path('styles/editor-style.css')); // Allow shortcode execution in widgets add_filter('widget_text', 'do_shortcode'); // Gets rid of the word "Archive:" in front of the Archive title add_filter('get_the_archive_title', function ($title) { if (is_post_type_archive()) { $title = post_type_archive_title(); } return $title; }); //remove_filter( 'the_content', 'wpautop' ); }
/** * 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; }
/** * 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; }
function flegondavid_the_tagline($tagline = '') { if ('blank' === get_header_textcolor()) { return ''; } if (is_home() || is_front_page()) { $tagline = get_bloginfo('description'); } elseif (is_archive()) { $tagline = post_type_archive_title('', false); } elseif (is_search()) { $_format = __('Search results for %s'); $tagline = sprintf($_format, get_search_query()); } else { $tagline = get_the_title(); } return $tagline; }
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); }
/** * Section template. */ function section_template() { if (is_category() || is_archive() || is_search() || is_author()) { echo '<div class="current_posts_info">'; if (is_search()) { printf('%s <strong>"%s"</strong>', __('Search results for', 'pagelines'), get_search_query()); } elseif (is_category()) { printf('%s <strong>"%s"</strong>', __('Currently viewing the category:', 'pagelines'), single_cat_title(false, false)); } elseif (is_tag()) { printf('%s <strong>"%s"</strong>', __('Currently viewing the tag:', 'pagelines'), single_tag_title(false, false)); } elseif (is_archive()) { if (is_author()) { global $author; global $author_name; $curauth = isset($_GET['author_name']) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); printf('%s <strong>"%s"</strong>', __('Posts by:', 'pagelines'), $curauth->display_name); } elseif (is_day()) { printf('%s <strong>"%s"</strong>', __('From the daily archives:', 'pagelines'), get_the_time('l, F j, Y')); } elseif (is_month()) { printf('%s <strong>"%s"</strong>', __('From the monthly archives:', 'pagelines'), get_the_time('F Y')); } elseif (is_year()) { printf('%s <strong>"%s"</strong>', __('From the yearly archives:', 'pagelines'), get_the_time('Y')); } else { if (is_post_type_archive()) { $title = post_type_archive_title(null, false); } if (!isset($title)) { $o = get_queried_object(); if (isset($o->name)) { $title = $o->name; } } if (!isset($title)) { $title = the_date(); } printf('%s <strong>"%s"</strong>', __('Viewing archives for ', 'pagelines'), $title); } } echo '</div>'; } }
/** * 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); }
/** * {@inheritdoc} */ public function getContext() { $data = []; $data['posts'] = $this->getPosts(); $data['title'] = __('Archive', 'zero'); if (is_day()) { $data['title'] = __('Archive: ', 'zero') . get_the_date('D M Y'); } elseif (is_month()) { $data['title'] = __('Archive: ', 'zero') . get_the_date('M Y'); } elseif (is_year()) { $data['title'] = __('Archive: ', 'zero') . get_the_date('Y'); } elseif (is_tag()) { $data['title'] = single_tag_title('', false); } elseif (is_category()) { $data['title'] = single_cat_title('', false); } elseif (is_post_type_archive()) { $data['title'] = post_type_archive_title('', false); } $data['pagination'] = \Timber::get_pagination(); return $data; }
/** * Page titles */ function title() { if (is_home()) { if (get_option('page_for_posts', true)) { return get_the_title(get_option('page_for_posts', true)); } else { return __('Latest Posts', 'sage'); } } elseif (is_archive()) { if (is_post_type_archive('galeriak')) { return post_type_archive_title(); } return get_the_archive_title(); } elseif (is_search()) { return sprintf(__('Search Results for %s', 'sage'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'sage'); } else { return get_the_title(); } }
/** * Theme setup */ function setup() { global $redux_demo; $options = $redux_demo; // Make theme available for translation // Community translations can be found at https://github.com/roots/sage-translations load_theme_textdomain('sage', get_template_directory() . '/lang'); // Enable plugins to manage the document title // http://codex.wordpress.org/Function_Reference/add_theme_support#Title_Tag add_theme_support('title-tag'); // Register wp_nav_menu() menus // http://codex.wordpress.org/Function_Reference/register_nav_menus register_nav_menus(['primary_navigation' => __('Primary Navigation', 'sage')]); // Add post thumbnails // http://codex.wordpress.org/Post_Thumbnails // http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size // http://codex.wordpress.org/Function_Reference/add_image_size add_theme_support('post-thumbnails'); add_image_size('slider', 1200, 600, true); add_image_size('case_studies', 300, 300, true); //update_option( 'medium_crop', 1 ); //Turn on image crop at medium size // Add post formats // http://codex.wordpress.org/Post_Formats //add_theme_support('post-formats', ['aside', 'gallery', 'link', 'image', 'quote', 'video', 'audio']); // Add HTML5 markup for captions // http://codex.wordpress.org/Function_Reference/add_theme_support#HTML5 add_theme_support('html5', ['caption', 'comment-form', 'comment-list']); // Tell the TinyMCE editor to use a custom stylesheet add_editor_style(Assets\asset_path('styles/editor-style.css')); // Allow shortcode execution in widgets add_filter('widget_text', 'do_shortcode'); // Gets rid of the word "Category:" in front of the Archive title add_filter('get_the_archive_title', function ($title) { if (is_post_type_archive()) { $title = post_type_archive_title(); } return $title; }); //remove_filter( 'the_content', 'wpautop' ); }
/** * custom_archive_title * * @return string */ public function custom_archive_title($title) { if (is_category()) { $title = sprintf(__(get_theme_mod('single_cat_title'), THEMENAME), single_cat_title('', false)); } else { if (is_tag()) { $title = sprintf(__(get_theme_mod('single_tag_title'), THEMENAME), single_tag_title('', false)); } else { if (is_author()) { $title = sprintf(__(get_theme_mod('single_author_title'), THEMENAME), '<span class="vcard">' . get_the_author() . '</span>'); } else { if (is_year()) { $title = sprintf(__(get_theme_mod('single_year_title'), THEMENAME), get_the_date(_x('Y', 'yearly archives date format'))); } else { if (is_month()) { $title = sprintf(__(get_theme_mod('single_month_title'), THEMENAME), get_the_date(_x('F Y', 'monthly archives date format'))); } else { if (is_day()) { $title = sprintf(__(get_theme_mod('single_day_title'), THEMENAME), get_the_date(_x('F j, Y', 'daily archives date format'))); } elseif (is_post_type_archive()) { $title = sprintf(__(get_theme_mod('post_type_archive_title'), THEMENAME), post_type_archive_title('', false)); } else { if (is_search()) { $title = sprintf(__(get_theme_mod('search_results_title')), get_search_query()); } else { if ($title === 'Archives') { $title = __(get_theme_mod('archives_title')); } } } } } } } } return $title; }
/** * Page titles * @return string The title to be printed on the page */ 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', 'conversion-insights-shared'); } } elseif (is_post_type_archive(CI_STAFF_TYPE)) { return post_type_archive_title('All ', true); } 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', 'conversion-insights-shared'), get_the_date()); } elseif (is_month()) { return sprintf(__('Monthly Archives: %s', 'conversion-insights-shared'), get_the_date('F Y')); } elseif (is_year()) { return sprintf(__('Yearly Archives: %s', 'conversion-insights-shared'), get_the_date('Y')); } elseif (is_author()) { $author = get_queried_object(); return sprintf(__('Author Archives: %s', 'conversion-insights-shared'), $author->display_name); } else { return single_cat_title('', false); } } elseif (is_search()) { return sprintf(__('Search Results for %s', 'conversion-insights-shared'), get_search_query()); } elseif (is_404()) { return __('Not Found', 'conversion-insights-shared'); } else { return get_the_title(); } }
<?php get_header(); ?> <div class="content"> <div class="wrap"> <main class="first" role="main"> <h1 class="archive-title h2"><?php post_type_archive_title(); ?> </h1> <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <article id="post-<?php the_ID(); ?> " <?php post_class('clearfix'); ?> role="article"> <header class="article-header">
function zn_archive_title() { if (is_category()) { $title = sprintf(__('Category: %s', 'zn_framework'), single_cat_title('', false)); } elseif (is_tag()) { $title = sprintf(__('Tag: %s', 'zn_framework'), single_tag_title('', false)); } elseif (is_author()) { $title = sprintf(__('Author: %s', 'zn_framework'), '<span class="vcard">' . get_the_author() . '</span>'); } elseif (is_year()) { $title = sprintf(__('Year: %s', 'zn_framework'), get_the_date(_x('Y', 'yearly archives date format', 'zn_framework'))); } elseif (is_month()) { $title = sprintf(__('Month: %s', 'zn_framework'), get_the_date(_x('F Y', 'monthly archives date format', 'zn_framework'))); } elseif (is_day()) { $title = sprintf(__('Day: %s', 'zn_framework'), get_the_date(_x('F j, Y', 'daily archives date format', 'zn_framework'))); } elseif (is_tax('post_format')) { if (is_tax('post_format', 'post-format-aside')) { $title = _x('Asides', 'post format archive title', 'zn_framework'); } elseif (is_tax('post_format', 'post-format-gallery')) { $title = _x('Galleries', 'post format archive title', 'zn_framework'); } elseif (is_tax('post_format', 'post-format-image')) { $title = _x('Images', 'post format archive title', 'zn_framework'); } elseif (is_tax('post_format', 'post-format-video')) { $title = _x('Videos', 'post format archive title', 'zn_framework'); } elseif (is_tax('post_format', 'post-format-quote')) { $title = _x('Quotes', 'post format archive title', 'zn_framework'); } elseif (is_tax('post_format', 'post-format-link')) { $title = _x('Links', 'post format archive title', 'zn_framework'); } elseif (is_tax('post_format', 'post-format-status')) { $title = _x('Statuses', 'post format archive title', 'zn_framework'); } elseif (is_tax('post_format', 'post-format-audio')) { $title = _x('Audio', 'post format archive title', 'zn_framework'); } elseif (is_tax('post_format', 'post-format-chat')) { $title = _x('Chats', 'post format archive title', 'zn_framework'); } } elseif (is_post_type_archive()) { $title = sprintf(__('Archives: %s', 'zn_framework'), 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', 'zn_framework'), $tax->labels->singular_name, single_term_title('', false)); } else { $title = __('Archives', 'zn_framework'); } /** * Filter the archive title. * * @since 4.1.0 * * @param string $title Archive title to be displayed. */ return apply_filters('get_the_archive_title', $title); //$output = ""; //if ( is_category() ) //{ // $output = __('Archive for category:', 'zn_framework' )." ".single_cat_title('',false); //} //elseif ( is_day() ) //{ // $output = __('Archive for date:','zn_framework')." ".get_the_time( __('F jS, Y','zn_framework') ); //} //elseif ( is_month() ) //{ // $output = __('Archive for month:','zn_framework')." ".get_the_time( __('F, Y','zn_framework') ); //} //elseif ( is_year() ) //{ // $output = __('Archive for year:','zn_framework')." ".get_the_time( __('Y','zn_framework') ); //} //elseif ( is_search() ) //{ // global $wp_query; // if( !empty( $wp_query->found_posts ) ) // { // $output = $wp_query->found_posts ." ". __('search results for:','zn_framework')." ".esc_attr( get_search_query() ); // } // else // { // if( !empty( $_GET['s'] ) ) // { // $output = __('Search results for:','zn_framework')." ".esc_attr( get_search_query() ); // } // else // { // $output = __('To search the site please enter a valid term','zn_framework'); // } // } //} //elseif ( is_author() ) //{ // $curauth = ( get_query_var('author_name') ) ? get_user_by( 'slug', get_query_var( 'author_name') ) : get_userdata( get_query_var('author') ); // $output = __('Author Archive','zn_framework')." "; // if(isset($curauth->nickname) && isset($curauth->ID)) // { // $output .= __('for:','zn_framework') ." ". $curauth->nickname; // } //} //elseif (is_tag()) //{ // $output = __('Tag Archive for:','zn_framework')." ".single_tag_title('',false); //} //elseif(is_tax()) //{ // $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); // $output = __('Archive for:','zn_framework')." ".$term->name; //} //else //{ // $output = __('Archives','zn_framework')." "; //} //if (isset($_GET['paged']) && !empty($_GET['paged'])) //{ // $output .= " (".__('Page','zn_framework')." ".$_GET['paged'].")"; //} //return $output; }
/** * Adds the items to the trail items array for post type archives. * * @since 0.6.0 * @access public * @return void */ public function do_post_type_archive_items() { /* Get the post type object. */ $post_type_object = get_post_type_object(get_query_var('post_type')); if (false !== $post_type_object->rewrite) { /* If 'with_front' is true, add $wp_rewrite->front to the trail. */ if ($post_type_object->rewrite['with_front']) { $this->do_rewrite_front_items(); } /* If there's a rewrite slug, check for parents. */ if (!empty($post_type_object->rewrite['slug'])) { $this->do_path_parents($post_type_object->rewrite['slug']); } } /* Add the post type [plural] name to the trail end. */ if (is_paged()) { $this->items[] = '<a href="' . esc_url(get_post_type_archive_link($post_type_object->name)) . '">' . post_type_archive_title('', false) . '</a>'; } elseif (true === $this->args['show_title']) { $this->items[] = post_type_archive_title('', false); } }
/** * Gets the archive Title, including filter. Also works in admin. * @NOTE Taken from WordPress core. Altered to work in the Admin area. * * @since 2.6.0 * * @param object $term The Term object. * @param array $args The Title arguments. * @return string The Archive Title, not escaped. */ public function get_the_real_archive_title($term = null, $args = array()) { if (empty($term)) { $term = get_queried_object(); } /** * Applies filters the_seo_framework_the_archive_title : { * @param string empty short circuit the function. * @param object $term The Term object. * } * * @since 2.6.0 */ $title = (string) apply_filters('the_seo_framework_the_archive_title', '', $term); if ($title) { return $title; } /** * @since 2.6.0 */ $use_prefix = $this->use_archive_prefix($term, $args); if ($this->is_category() || $this->is_tag() || $this->is_tax()) { $title = $this->single_term_title('', false, $term); /* translators: Front-end output. 1: Taxonomy singular name, 2: Current taxonomy term */ $title = $use_prefix ? sprintf(__('%1$s: %2$s', 'autodescription'), $this->get_the_term_name($term), $title) : $title; } elseif ($this->is_author()) { $title = get_the_author(); /* translators: Front-end output. */ $title = $use_prefix ? sprintf(__('Author: %s', 'autodescription'), $title) : $title; } elseif ($this->is_date()) { if ($this->is_year()) { /* translators: Front-end output. */ $title = get_the_date(_x('Y', 'yearly archives date format', 'autodescription')); /* translators: Front-end output. */ $title = $use_prefix ? sprintf(__('Year: %s', 'autodescription'), $title) : $title; } elseif ($this->is_month()) { /* translators: Front-end output. */ $title = get_the_date(_x('F Y', 'monthly archives date format', 'autodescription')); /* translators: Front-end output. */ $title = $use_prefix ? sprintf(__('Month: %s', 'autodescription'), $title) : $title; } elseif ($this->is_day()) { /* translators: Front-end output. */ $title = get_the_date(_x('F j, Y', 'daily archives date format', 'autodescription')); /* translators: Front-end output. */ $title = $use_prefix ? sprintf(__('Day: %s', 'autodescription'), $title) : $title; } } elseif ($this->is_tax('post_format')) { if (is_tax('post_format', 'post-format-aside')) { /* translators: Front-end output. */ $title = _x('Asides', 'post format archive title', 'autodescription'); } elseif ($this->is_tax('post_format', 'post-format-gallery')) { /* translators: Front-end output. */ $title = _x('Galleries', 'post format archive title', 'autodescription'); } elseif ($this->is_tax('post_format', 'post-format-image')) { /* translators: Front-end output. */ $title = _x('Images', 'post format archive title', 'autodescription'); } elseif ($this->is_tax('post_format', 'post-format-video')) { /* translators: Front-end output. */ $title = _x('Videos', 'post format archive title', 'autodescription'); } elseif ($this->is_tax('post_format', 'post-format-quote')) { /* translators: Front-end output. */ $title = _x('Quotes', 'post format archive title', 'autodescription'); } elseif ($this->is_tax('post_format', 'post-format-link')) { /* translators: Front-end output. */ $title = _x('Links', 'post format archive title', 'autodescription'); } elseif ($this->is_tax('post_format', 'post-format-status')) { /* translators: Front-end output. */ $title = _x('Statuses', 'post format archive title', 'autodescription'); } elseif ($this->is_tax('post_format', 'post-format-audio')) { /* translators: Front-end output. */ $title = _x('Audio', 'post format archive title', 'autodescription'); } elseif ($this->is_tax('post_format', 'post-format-chat')) { /* translators: Front-end output. */ $title = _x('Chats', 'post format archive title', 'autodescription'); } } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); /* translators: Front-end output. */ $title = $use_prefix ? sprintf(__('Archives: %s'), $title) : $title; } elseif (isset($term)) { $title = $this->single_term_title('', false, $term); if ($use_prefix) { /* translators: Front-end output. 1: Taxonomy singular name, 2: Current taxonomy term */ $title = sprintf(__('%1$s: %2$s', 'autodescription'), $this->get_the_term_name($term, true, false), $title); } } else { /* translators: Front-end output. */ $title = __('Archives', 'autodescription'); } return $title; }
/** * Display the links to the extra feeds such as category feeds. * * @since 2.8.0 * * @param array $args Optional arguments. */ function feed_links_extra($args = array()) { $defaults = array('separator' => _x('»', 'feed link'), 'singletitle' => __('%1$s %2$s %3$s Comments Feed'), 'cattitle' => __('%1$s %2$s %3$s Category Feed'), 'tagtitle' => __('%1$s %2$s %3$s Tag Feed'), 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'), 'posttypetitle' => __('%1$s %2$s %3$s Feed')); $args = wp_parse_args($args, $defaults); if (is_singular()) { $id = 0; $post = get_post($id); if (comments_open() || pings_open() || $post->comment_count > 0) { $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false))); $href = get_post_comments_feed_link($post->ID); } } elseif (is_post_type_archive()) { $post_type = get_query_var('post_type'); if (is_array($post_type)) { $post_type = reset($post_type); } $post_type_obj = get_post_type_object($post_type); $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name); $href = get_post_type_archive_feed_link($post_type_obj->name); } elseif (is_category()) { $term = get_queried_object(); if ($term) { $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name); $href = get_category_feed_link($term->term_id); } } elseif (is_tag()) { $term = get_queried_object(); if ($term) { $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name); $href = get_tag_feed_link($term->term_id); } } elseif (is_author()) { $author_id = intval(get_query_var('author')); $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id)); $href = get_author_feed_link($author_id); } elseif (is_search()) { $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false)); $href = get_search_feed_link(); } elseif (is_post_type_archive()) { $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false)); $post_type_obj = get_queried_object(); if ($post_type_obj) { $href = get_post_type_archive_feed_link($post_type_obj->name); } } if (isset($title) && isset($href)) { echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr($title) . '" href="' . esc_url($href) . '" />' . "\n"; } }
function elegant_titles_filter($custom_title, $sep) { global $shortname, $themename; $custom_title = ''; $sitename = get_bloginfo('name'); $site_description = get_bloginfo('description'); #if the title is being displayed on the homepage if ((is_home() || is_front_page()) && !elegant_is_blog_posts_page()) { if ('on' === et_get_option($shortname . '_seo_home_title')) { $custom_title = et_get_option($shortname . '_seo_home_titletext'); } else { $seo_home_type = et_get_option($shortname . '_seo_home_type'); $seo_home_separate = et_get_option($shortname . '_seo_home_separate'); if ($seo_home_type == 'BlogName | Blog description') { $custom_title = $sitename . esc_html($seo_home_separate) . $site_description; } if ($seo_home_type == 'Blog description | BlogName') { $custom_title = $site_description . esc_html($seo_home_separate) . $sitename; } if ($seo_home_type == 'BlogName only') { $custom_title = $sitename; } } } #if the title is being displayed on single posts/pages if ((is_single() || is_page()) && !is_front_page() || elegant_is_blog_posts_page()) { global $wp_query; $postid = elegant_is_blog_posts_page() ? intval(get_option('page_for_posts')) : $wp_query->post->ID; $key = et_get_option($shortname . '_seo_single_field_title'); $exists3 = get_post_meta($postid, '' . $key . '', true); if ('on' === et_get_option($shortname . '_seo_single_title') && '' !== $exists3) { $custom_title = $exists3; } else { $seo_single_type = et_get_option($shortname . '_seo_single_type'); $seo_single_separate = et_get_option($shortname . '_seo_single_separate'); $page_title = single_post_title('', false); if ($seo_single_type == 'BlogName | Post title') { $custom_title = $sitename . esc_html($seo_single_separate) . $page_title; } if ($seo_single_type == 'Post title | BlogName') { $custom_title = $page_title . esc_html($seo_single_separate) . $sitename; } if ($seo_single_type == 'Post title only') { $custom_title = $page_title; } } } #if the title is being displayed on index pages (categories/archives/search results) if (is_category() || is_archive() || is_search() || is_404()) { $page_title = ''; $seo_index_type = et_get_option($shortname . '_seo_index_type'); $seo_index_separate = et_get_option($shortname . '_seo_index_separate'); if (is_category() || is_tag() || is_tax()) { $page_title = single_term_title('', false); } else { if (is_post_type_archive()) { $page_title = post_type_archive_title('', false); } else { if (is_author()) { $page_title = get_the_author_meta('display_name', get_query_var('author')); } else { if (is_date()) { $page_title = __('Archives', $themename); } else { if (is_search()) { $page_title = sprintf(__('Search results for "%s"', $themename), esc_attr(get_search_query())); } else { if (is_404()) { $page_title = __('404 Not Found', $themename); } } } } } } if ($seo_index_type == 'BlogName | Category name') { $custom_title = $sitename . esc_html($seo_index_separate) . $page_title; } if ($seo_index_type == 'Category name | BlogName') { $custom_title = $page_title . esc_html($seo_index_separate) . $sitename; } if ($seo_index_type == 'Category name only') { $custom_title = $page_title; } } return wp_strip_all_tags($custom_title); }
/** * A Breadcrumb Trail Filling Function * * This functions fills a breadcrumb for a post type archive (WP 3.1 feature) */ protected function do_archive_by_post_type() { //Place the breadcrumb in the trail, uses the constructor to set the title, prefix, and suffix, get a pointer to it in return $breadcrumb = $this->add(new bcn_breadcrumb(post_type_archive_title('', false), $this->opt['Hpost_' . get_post_type() . '_template_no_anchor'], array('archive', 'post-' . get_post_type() . '-archive', 'current-item'))); if ($this->opt['bcurrent_item_linked'] || is_paged() && $this->opt['bpaged_display']) { $breadcrumb->set_template($this->opt['Hpost_' . get_post_type() . '_template']); //Deal with the anchor $breadcrumb->set_url(get_post_type_archive_link(get_post_type())); } }