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;
 }
Пример #2
1
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";
}
Пример #3
1
function title()
{
    if (is_category()) {
        echo 'Category Archive for &quot;';
        single_cat_title();
        echo '&quot; | ';
        bloginfo('name');
    } elseif (is_tag()) {
        echo 'Tag Archive for &quot;';
        single_tag_title();
        echo '&quot; | ';
        bloginfo('name');
    } elseif (is_archive()) {
        wp_title('');
        echo ' Archive | ';
        bloginfo('name');
    } elseif (is_search()) {
        echo 'Search for &quot;' . wp_specialchars($s) . '&quot; | ';
        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 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');
 }
Пример #5
0
 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']) : '&#8212;';
     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') . ' &#8220;' . attribute_escape(get_search_query()) . '&#8221;';
         #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
 }
Пример #6
0
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 &#8216;') . single_cat_title("", false) . __('&#8217; Category') . '</h3>';
        /* If this is a tag archive */
    } elseif (is_tag()) {
        $title = '<h3 class="pagetitle">' . __('Posts Tagged &#8216;') . single_tag_title("", false) . __('&#8217;') . '</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);
}
Пример #7
0
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, ' &raquo; ') . $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> &raquo; ' . $titles . '	</div>' . '</div>';
}
Пример #8
0
 /**
  * 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;
     }
 }
Пример #9
0
function wolf_breadcrumbs_get_category_links($page_id = '')
{
    if (strlen(trim($page_id)) > 0) {
        $cat_name = '';
        $cat_url = '';
        $cats = get_the_category($page_id);
        if (count($cats) > 0) {
            $cat = $cats[0];
            $cat_id = $cat->cat_ID;
            $cat_name = $cat->cat_name;
            $cat_url = get_category_link($cat_id);
        }
    } else {
        if (single_tag_title('', false == '')) {
            $cat_id = get_query_var('cat');
            $cat_name = get_cat_name($cat_id);
            $cat_url = get_category_link($cat_id);
        } else {
            $cat_url = get_tag_link(get_query_var('tag_id'));
            $cat_name = single_tag_title('', false);
        }
    }
    $cat_link = '<li>';
    $cat_link .= '<a href="' . $cat_url . '" itemprop="url"><span itemprop="title">' . $cat_name . '</span></a>';
    if (strlen(trim($page_id)) > 0 && strlen(trim($cat_name)) > 0) {
        $cat_link .= '<span class="divider">/</span>';
    }
    $cat_link .= '</li>';
    return $cat_link;
}
Пример #10
0
/**
 * Prints better page title
 */
function perfect_title()
{
    echo '<title>';
    if (function_exists('is_tag') && is_tag()) {
        single_tag_title(__('Tag Archive for') . '&quot;');
        $output .= '&quot; - ';
    } elseif (is_archive()) {
        wp_title('');
        echo __('Archive') . ' - ';
    } elseif (is_search()) {
        echo __('Search for') . '&quot;' . esc_html($s) . '&quot; - ';
    } elseif (!is_404() && is_single() || is_page()) {
        wp_title('');
        echo ' - ';
    } elseif (is_404()) {
        echo __('Not Found') . '-';
    }
    if (is_home()) {
        bloginfo('name');
        echo ' - ';
        bloginfo('description');
    } else {
        bloginfo('name');
    }
    if ($paged > 1) {
        echo ' - ' . __('page') . ' ' . $paged;
    }
    echo '</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();
     }
 }
Пример #12
0
 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;
 }
Пример #13
0
function bavota_breadcrumbs()
{
    if (!is_front_page()) {
        echo '<a href="' . home_url('/') . 'blog">Blog</a><span class="divider"> <i class="icon-angle-right"></i> </span>';
    }
    if (is_category() || is_single()) {
        $category = get_the_category();
        $ID = $category[0]->cat_ID;
        // echo get_category_parents($ID, TRUE, ' ', FALSE ); // was causing errors in the error_log
        echo is_wp_error($cat_parents = get_category_parents($ID, TRUE, ' ', FALSE)) ? '' : $cat_parents;
    }
    $mytitle = get_the_title();
    if (strlen($mytitle) > 22) {
        $mytitle = substr($mytitle, 0, 38) . "...";
    }
    if (is_single() || is_page()) {
        echo ' <span class="divider"> <i class="icon-angle-right"></i> </span> ';
        echo $mytitle;
    }
    if (is_tag()) {
        echo "Tag: " . single_tag_title('', FALSE);
    }
    if (is_404()) {
        echo "404 - Page not Found";
    }
    if (is_search()) {
        echo "Search";
    }
    if (is_year()) {
        echo get_the_time('Y');
    }
}
Пример #14
0
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);
}
Пример #15
0
/**
 * 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">&quot;' . $_GET['s'] . '&quot;</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;
}
Пример #16
0
 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";
         }
     }
 }
Пример #17
0
/**
 *  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;
}
/**
 * [UNFINISHED] Generates a breadcrumb or the current page.
 * 
 * @return string The breadcrumb HTML
 */
function get_the_breadcrumb()
{
    global $post;
    $str = '<ul id="breadcrumbs">';
    if (!is_home()) {
        $str .= sprintf('<li><a href="%1$s">Home</a></li><li class="separator"> / </li>', home_url('/'));
        if (is_category() || is_single()) {
            $categories = get_the_category();
            if ($categories) {
                $cats = array();
                foreach (array_slice($categories, 0, 3) as $category) {
                    $cats[] = sprintf('<li><a href="%1$s">%2$s</a></li>', get_category_link($category->term_id), $category->cat_name);
                }
                $str .= implode('<li class="separator"> / </li>', $cats);
            }
            if (is_single()) {
                $str .= '<li class="separator"> / </li><li>' . get_the_title() . '</li>';
            }
        } elseif (is_page()) {
            if ($post->post_parent) {
                $anc = get_post_ancestors($post->ID);
                $title = get_the_title();
                foreach ($anc as $ancestor) {
                    $output = '<li><a href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li> <li class="separator">/</li>';
                }
                $str .= $output;
                $str .= '<strong title="' . $title . '
				"> ' . $title . '</strong>';
            } else {
                $str .= '<li><strong> ' . get_the_title() . '</strong></li>';
            }
        }
    } elseif (is_tag()) {
        single_tag_title();
    } elseif (is_day()) {
        $str .= "<li>Archive for ";
        the_time('F jS, Y');
        $str .= '</li>';
    } elseif (is_month()) {
        $str .= "<li>Archive for ";
        the_time('F, Y');
        $str .= '</li>';
    } elseif (is_year()) {
        $str .= "<li>Archive for ";
        the_time('Y');
        $str .= '</li>';
    } elseif (is_author()) {
        $str .= "<li>Author Archive";
        $str .= '</li>';
    } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
        $str .= "<li>Blog Archives";
        $str .= '</li>';
    } elseif (is_search()) {
        $str .= "<li>Search Results";
        $str .= '</li>';
    }
    $str .= '</ul>';
}
Пример #19
0
 /**
  * Retrieve the archive title based on the queried object.
  *
  * @return string Archive title.
  */
 function get_the_archive_title($before = '', $after = '')
 {
     if (!TF_Model::is_template_page()) {
         if (is_category()) {
             $title = single_cat_title('', false);
         } elseif (is_tag()) {
             $title = single_tag_title('', false);
         } elseif (is_author()) {
             $title = sprintf(__('Author: %s', 'themify-flow'), '<span class="vcard">' . get_the_author() . '</span>');
         } elseif (is_year()) {
             $title = sprintf(__('Year: %s', 'themify-flow'), get_the_date(_x('Y', 'yearly archives date format', 'themify-flow')));
         } elseif (is_month()) {
             $title = sprintf(__('Month: %s', 'themify-flow'), get_the_date(_x('F Y', 'monthly archives date format', 'themify-flow')));
         } elseif (is_day()) {
             $title = sprintf(__('Day: %s', 'themify-flow'), get_the_date(_x('F j, Y', 'daily archives date format', 'themify-flow')));
         } elseif (is_tax('post_format')) {
             if (is_tax('post_format', 'post-format-aside')) {
                 $title = _x('Asides', 'post format archive title', 'themify-flow');
             } elseif (is_tax('post_format', 'post-format-gallery')) {
                 $title = _x('Galleries', 'post format archive title', 'themify-flow');
             } elseif (is_tax('post_format', 'post-format-image')) {
                 $title = _x('Images', 'post format archive title', 'themify-flow');
             } elseif (is_tax('post_format', 'post-format-video')) {
                 $title = _x('Videos', 'post format archive title', 'themify-flow');
             } elseif (is_tax('post_format', 'post-format-quote')) {
                 $title = _x('Quotes', 'post format archive title', 'themify-flow');
             } elseif (is_tax('post_format', 'post-format-link')) {
                 $title = _x('Links', 'post format archive title', 'themify-flow');
             } elseif (is_tax('post_format', 'post-format-status')) {
                 $title = _x('Statuses', 'post format archive title', 'themify-flow');
             } elseif (is_tax('post_format', 'post-format-audio')) {
                 $title = _x('Audio', 'post format archive title', 'themify-flow');
             } elseif (is_tax('post_format', 'post-format-chat')) {
                 $title = _x('Chats', 'post format archive title', 'themify-flow');
             }
         } elseif (is_post_type_archive()) {
             $title = sprintf(__('%s', 'themify-flow'), 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', 'themify-flow'), $tax->labels->singular_name, single_term_title('', false));
         } else {
             $title = '';
         }
         /**
          * Filter the archive title.
          *
          * @param string $title Archive title to be displayed.
          */
         $title = apply_filters('get_the_archive_title', $title);
         if (!empty($title)) {
             $title = $before . $title . $after;
         }
     } else {
         $title = sprintf('<p>%s</p>', __('<strong>Category Title</strong>', 'themify-flow'));
     }
     return $title;
 }
Пример #20
0
 function build_jsonldBreadcrumb()
 {
     $jsonLD["@context"] = "http://schema.org/";
     $jsonLD["@type"] = "BreadcrumbList";
     //---------------------------------
     // pre-define some variables
     //---------------------------------
     $home_title = get_bloginfo('name');
     $home_url = esc_url(home_url('/'));
     $blog_url = get_permalink(get_option('page_for_posts'));
     $blog_title = get_the_title(get_option('page_for_posts', true));
     $url = $url ? $url : get_permalink();
     $title = $title ? $title : get_the_title();
     $itemList = array();
     //----------------------------------
     // Output
     //-----------------------------------
     $itemList[] = array("@type" => "ListItem", "position" => 1, "item" => array('@id' => $home_url, 'name' => $home_title));
     //----------------------------------------------
     // figure out the next number
     // <meta property="position" content="{NUM}">
     //----------------------------------------------
     $next = 2;
     if (is_single() or is_home()) {
         //-------------------------------------
         // we have a blog "post"
         // so we added the blog url (not home)
         // so next is 3 not 2!
         //--------------------------------------
         $itemList[] = array("@type" => "ListItem", "position" => 2, "item" => array('@id' => $blog_url, 'name' => $blog_title));
         $next = 3;
     }
     if (is_single() or is_page() or is_tag() or is_category()) {
         //----------------------------------
         // is it a tag?
         //----------------------------------
         if (is_tag()) {
             $title = single_tag_title("", false);
             $tag_id = get_term_by('name', $title, 'post_tag');
             $url = get_tag_link($tag_id->term_id);
         }
         if (is_category()) {
             $title = single_cat_title("", false);
             $category_id = get_cat_ID($title);
             $url = get_category_link($category_id);
         }
         $itemList[] = array("@type" => "ListItem", "position" => $next, "item" => array('@id' => $url, 'name' => $title));
     }
     $jsonLD["itemListElement"] = $itemList;
     /*echo '<pre>';
     	print_r(json_encode($jsonLD));
     	echo '</pre>';*/
     if ((is_page() or is_single() or is_home() or is_tag() or is_category()) and !is_front_page()) {
         echo '<script type="application/ld+json">';
         echo json_encode($jsonLD);
         echo '</script>';
     }
 }
 /**
  * This checks on which page we're and display the correct breancrumb navigation
  * @return string | void
  */
 public function output_html()
 {
     global $post, $cat, $wp_query;
     $output = '';
     $arc_year = get_the_time('Y');
     $arc_month = get_the_time('F');
     $arc_day = get_the_time('d');
     $arc_day_full = get_the_time('l');
     $url_year = get_year_link($arc_year);
     $url_month = get_month_link($arc_year, $arc_month);
     $templates = array_keys(fw_get_db_ext_settings_option('ns-breadcrumb', 'hide-bdb-templates', array()));
     $types = array_keys(fw_get_db_ext_settings_option('ns-breadcrumb', 'hide-bdb-types', array()));
     if (in_array(get_post_type(), $types)) {
         return;
     }
     if (!is_front_page()) {
         //breadcrumb for single post
         if (is_single() && !in_array('single', $templates)) {
             $output = $this->is_single_post();
         } elseif (is_category() && !in_array('category', $templates)) {
             $output = '<li>' . $this->set_opt('category') . get_category_parents($cat, true, ' &raquo; ') . '</li>';
         } elseif (is_tax() && !in_array('category', $templates)) {
             $term = $wp_query->queried_object;
             $output = '<li>' . $this->set_opt('category') . $term->name . '</li>';
         } elseif (is_tag() && !in_array('tag', $templates)) {
             $output = '<li>' . $this->set_opt('tags') . single_tag_title('', false) . '</li>';
         } elseif (is_day() && !in_array('archive', $templates)) {
             $output = '<li><a href="' . $url_year . '">' . $arc_year . '</a></li>';
             $output .= '<li><a href="' . $url_month . '">' . $arc_month . '</a></li><li>' . $arc_day . ' (' . $arc_day_full . ')</li>';
         } elseif (is_month() && !in_array('archive', $templates)) {
             $output = '<li><a href="' . $url_year . '">' . $arc_year . '</a></li><li>' . $arc_month . '</li>';
         } elseif (is_year() && !in_array('archive', $templates)) {
             $output = '<li>' . $arc_year . '</li>';
         } elseif (is_search() && !in_array('search', $templates)) {
             $output = '<li>' . $this->set_opt('search') . get_search_query() . '</li>';
         } elseif (is_page() && !$post->post_parent && !in_array('page', $templates)) {
             $output = '<li>' . get_the_title() . '</li>';
         } elseif (is_page() && $post->post_parent && !in_array('page', $templates)) {
             $output = $this->is_page_n_has_parent();
         } elseif (is_author() && !in_array('author', $templates)) {
             global $author;
             $user_info = get_userdata($author);
             $output = '<li>' . $this->set_opt('author') . $user_info->display_name . '</li>';
         } elseif (is_404() && !in_array('404', $templates)) {
             $output = '<li>' . $this->set_opt('error') . '</li>';
         } else {
             //All other cases no Breadcrumb trail.
         }
     }
     if (!empty($output)) {
         $return = '<ul class="breadcrumb">';
         $return .= $this->set_opt('el_prefix');
         $return .= $output;
         $return .= '</ul>';
         echo $return;
     }
 }
Пример #22
0
function breadcrumbs()
{
    global $post;
    echo '<ol class="breadcrumb">';
    if (!is_home()) {
        echo '<li><a href="';
        echo get_option('home');
        echo '">';
        echo 'Home';
        echo '</a></li>';
        if (is_category() || is_single()) {
            echo '<li>';
            the_category(' </li><li> ');
            if (is_single()) {
                echo '</li><li>';
                the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            if ($post->post_parent) {
                $anc = get_post_ancestors($post->ID);
                $title = get_the_title();
                foreach ($anc as $ancestor) {
                    $output = '<li><a href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li> ';
                }
                echo $output;
                echo '<strong title="' . $title . '"> ' . $title . '</strong>';
            } else {
                echo '<li><strong> ' . get_the_title() . '</strong></li>';
            }
        }
    } elseif (is_tag()) {
        single_tag_title();
    } elseif (is_day()) {
        echo "<li>Archive for ";
        the_time('F jS, Y');
        echo '</li>';
    } elseif (is_month()) {
        echo "<li>Archive for ";
        the_time('F, Y');
        echo '</li>';
    } elseif (is_year()) {
        echo "<li>Archive for ";
        the_time('Y');
        echo '</li>';
    } elseif (is_author()) {
        echo "<li>Author Archive";
        echo '</li>';
    } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
        echo "<li>Blog Archives";
        echo '</li>';
    } elseif (is_search()) {
        echo "<li>Search Results";
        echo '</li>';
    }
    echo '</ol>';
}
Пример #23
0
function agatha_breadcrumb()
{
    global $post;
    echo '<ul id="trilha">';
    if (!is_home()) {
        echo '<li><a href="';
        echo get_option('home');
        echo '">';
        echo 'Página inicial';
        echo '</a></li><li class="separador"> / </li>';
        if (is_category() || is_single()) {
            echo '<li>';
            the_category(' </li><li class="separador"> / </li><li> ');
            if (is_single()) {
                echo '</li><li class="separador"> / </li><li>';
                the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            if ($post->post_parent) {
                $anc = get_post_ancestors($post->ID);
                $title = get_the_title();
                foreach ($anc as $ancestor) {
                    $output = '<li><a href="' . get_permalink($ancestor) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li> <li class="separador">/</li>';
                }
                echo $output;
                echo '<strong title="' . $title . '"> ' . $title . '</strong>';
            } else {
                echo '<li><strong> ' . get_the_title() . '</strong></li>';
            }
        }
    } elseif (is_tag()) {
        single_tag_title();
    } elseif (is_day()) {
        echo "<li>Arquivo de ";
        the_time('j \\d\\e F \\d\\e Y');
        echo '</li>';
    } elseif (is_month()) {
        echo "<li>Arquivo de ";
        the_time('F \\d\\e Y');
        echo '</li>';
    } elseif (is_year()) {
        echo "<li>Arquivo de ";
        the_time('Y');
        echo '</li>';
    } elseif (is_author()) {
        echo "<li>Arquivo do autor";
        echo '</li>';
    } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
        echo "<li>Arquivo do blog";
        echo '</li>';
    } elseif (is_search()) {
        echo "<li>Resultados da pesquisa";
        echo '</li>';
    }
    echo '</ul>';
}
Пример #24
0
function get_template_title()
{
    $title = '';
    ob_start();
    _e('Tag Archives: ', 'blankslate');
    single_tag_title();
    $title = ob_get_contents();
    ob_end_clean();
    return $title;
}
Пример #25
0
function the_crumbs()
{
    echo '<nav class="crumbs">现在位置: ';
    echo '<a title="返回首页" href="';
    echo get_settings('home');
    echo '">';
    echo '首页';
    echo "</a>";
    if (is_category()) {
        echo ' &gt; ';
        echo get_category_parents(get_query_var('cat'), true, ' &gt; ');
        echo ' 文章 ';
    }
    if (is_single()) {
        echo ' &gt; ';
        echo the_category(' &gt; ', 'multiple');
        echo ' &gt; ';
        echo ' 正文 ';
    }
    if (is_page()) {
        echo ' &gt; ';
        echo the_title();
    } elseif (is_tag()) {
        echo ' &gt; ';
        single_tag_title();
        echo ' &gt; 文章 ';
    } elseif (is_day()) {
        echo ' &gt; ';
        echo "发表于";
        the_time('Y年m月d日');
        echo '的文章';
    } elseif (is_month()) {
        echo ' &gt; ';
        echo "发表于";
        the_time('Y年m月');
        echo '的文章';
    } elseif (is_year()) {
        echo ' &gt; ';
        echo "发表于";
        the_time('Y年');
        echo '的文章';
    } elseif (is_author()) {
        echo ' &gt; ';
        echo wp_title('');
        echo '发表的文章';
    } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
        echo "Blog Archives";
        echo '';
    } elseif (is_search()) {
        echo ' &gt; ';
        echo "搜索结果";
        echo '';
    }
    echo '</nav>';
}
Пример #26
0
    function gabfire_catNameDesc()
    {
        if (is_category()) {
            ?>
			<section class="row">
				<div class="col-md-12">
					<div class="post-lead">
						<?php 
            if (is_category()) {
                ?>
							<h1><?php 
                single_cat_title();
                ?>
</h1>
							<?php 
                echo category_description();
                ?>
						<?php 
            } else {
                ?>
							<h1 class="post-title"><?php 
                single_tag_title();
                ?>
</h1>
							<?php 
                echo tag_description();
                ?>
						<?php 
            }
            ?>
					</div>
				</div>
		</section><?php 
        } elseif (is_search()) {
            ?>
			<section class="row archive">
				<div class="col-md-12">
					<div class="post-lead">
						<h1><i class='fa fa-search'></i>  <?php 
            echo get_search_query();
            ?>
</h1>
						<?php 
            $search_query = get_search_query();
            ?>
						<p><?php 
            printf(esc_attr__('Search results for %1$s', 'gabfire'), $search_query);
            ?>
</p>
					</div>
				</div>
		</section><?php 
        }
    }
Пример #27
0
/**
 * Extend archive title
 *
 * @since  1.0.0
 */
function satu_extend_archive_title($title)
{
    if (is_category()) {
        $title = single_cat_title('', false);
    } elseif (is_tag()) {
        $title = single_tag_title('', false);
    } elseif (is_author()) {
        $title = get_the_author();
    }
    return $title;
}
Пример #28
0
 /**
  * Shim for `the_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 the_archive_title($before = '', $after = '')
 {
     if (is_category()) {
         $title = sprintf(esc_html__('Category: %s', 'f560bethel'), single_cat_title('', false));
     } elseif (is_tag()) {
         $title = sprintf(esc_html__('Tag: %s', 'f560bethel'), single_tag_title('', false));
     } elseif (is_author()) {
         $title = sprintf(esc_html__('Author: %s', 'f560bethel'), '<span class="vcard">' . get_the_author() . '</span>');
     } elseif (is_year()) {
         $title = sprintf(esc_html__('Year: %s', 'f560bethel'), get_the_date(esc_html_x('Y', 'yearly archives date format', 'f560bethel')));
     } elseif (is_month()) {
         $title = sprintf(esc_html__('Month: %s', 'f560bethel'), get_the_date(esc_html_x('F Y', 'monthly archives date format', 'f560bethel')));
     } elseif (is_day()) {
         $title = sprintf(esc_html__('Day: %s', 'f560bethel'), get_the_date(esc_html_x('F j, Y', 'daily archives date format', 'f560bethel')));
     } elseif (is_tax('post_format')) {
         if (is_tax('post_format', 'post-format-aside')) {
             $title = esc_html_x('Asides', 'post format archive title', 'f560bethel');
         } elseif (is_tax('post_format', 'post-format-gallery')) {
             $title = esc_html_x('Galleries', 'post format archive title', 'f560bethel');
         } elseif (is_tax('post_format', 'post-format-image')) {
             $title = esc_html_x('Images', 'post format archive title', 'f560bethel');
         } elseif (is_tax('post_format', 'post-format-video')) {
             $title = esc_html_x('Videos', 'post format archive title', 'f560bethel');
         } elseif (is_tax('post_format', 'post-format-quote')) {
             $title = esc_html_x('Quotes', 'post format archive title', 'f560bethel');
         } elseif (is_tax('post_format', 'post-format-link')) {
             $title = esc_html_x('Links', 'post format archive title', 'f560bethel');
         } elseif (is_tax('post_format', 'post-format-status')) {
             $title = esc_html_x('Statuses', 'post format archive title', 'f560bethel');
         } elseif (is_tax('post_format', 'post-format-audio')) {
             $title = esc_html_x('Audio', 'post format archive title', 'f560bethel');
         } elseif (is_tax('post_format', 'post-format-chat')) {
             $title = esc_html_x('Chats', 'post format archive title', 'f560bethel');
         }
     } elseif (is_post_type_archive()) {
         $title = sprintf(esc_html__('Archives: %s', 'f560bethel'), 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', 'f560bethel'), $tax->labels->singular_name, single_term_title('', false));
     } else {
         $title = esc_html__('Archives', 'f560bethel');
     }
     /**
      * 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.
     }
 }
Пример #29
-1
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";
}
 /**
  * you can override the defaults set in the archive method in any one
  * of these archive methods below;
  */
 function tag()
 {
     /**
      * set the page header for the tag archive
      */
     $this->View->add('layout_header_title', sprintf(__("Posts tagged: %s "), single_tag_title("", 0)));
 }