当前位置: 首页>>代码示例>>PHP>>正文


PHP single_tag_title函数代码示例

本文整理汇总了PHP中single_tag_title函数的典型用法代码示例。如果您正苦于以下问题:PHP single_tag_title函数的具体用法?PHP single_tag_title怎么用?PHP single_tag_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了single_tag_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: presscore_search_title_shortcode

 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;
 }
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:35,代码来源:shortcode-search-title.php

示例2: theme_description

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";
}
开发者ID:Nsking-xs,项目名称:rccoder,代码行数:32,代码来源:key.php

示例3: title

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');
    }
}
开发者ID:indee,项目名称:indee-website,代码行数:33,代码来源:globals.func.php

示例4: OnPrePageLoad

 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');
 }
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:33,代码来源:category-surreyladies.php

示例5: title

 function title()
 {
     global $thesis_site, $thesis_pages;
     $site_name = get_bloginfo('name');
     #wp
     $separator = $thesis_site->head['title']['separator'] ? urldecode($thesis_site->head['title']['separator']) : '&#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
 }
开发者ID:JGrubb,项目名称:Almond-Tree,代码行数:60,代码来源:head.php

示例6: or_page_title

function or_page_title()
{
    $post = $posts[0];
    // Hack. Set $post so that the_date() works.
    /* If this is a category archive */
    if (is_category()) {
        $title = '<h3 class="pagetitle">' . __('Archive for the &#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);
}
开发者ID:jonkemp,项目名称:outrigger,代码行数:30,代码来源:functions.php

示例7: crumb

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>';
}
开发者ID:netwolf103,项目名称:dvpoo,代码行数:29,代码来源:crumb.php

示例8: sociallyviral_archive_title

 /**
  * Shim for `sociallyviral_archive_title()`.
  *
  * Display the archive title based on the queried object.
  *
  * @todo Remove this function when WordPress 4.3 is released.
  *
  * @param string $before Optional. Content to prepend to the title. Default empty.
  * @param string $after  Optional. Content to append to the title. Default empty.
  */
 function sociallyviral_archive_title($before = '', $after = '')
 {
     if (is_category()) {
         $title = sprintf(__('Category: %s', 'sociallyviral'), single_cat_title('', false));
     } elseif (is_tag()) {
         $title = sprintf(__('Tag: %s', 'sociallyviral'), single_tag_title('', false));
     } elseif (is_author()) {
         $title = sprintf(__('Author: %s', 'sociallyviral'), '<span class="vcard">' . get_the_author() . '</span>');
     } elseif (is_year()) {
         $title = sprintf(__('Year: %s', 'sociallyviral'), get_the_date(_x('Y', 'yearly archives date format', 'sociallyviral')));
     } elseif (is_month()) {
         $title = sprintf(__('Month: %s', 'sociallyviral'), get_the_date(_x('F Y', 'monthly archives date format', 'sociallyviral')));
     } elseif (is_day()) {
         $title = sprintf(__('Day: %s', 'sociallyviral'), get_the_date(_x('F j, Y', 'daily archives date format', 'sociallyviral')));
     } elseif (is_post_type_archive()) {
         $title = sprintf(__('Archives: %s', 'sociallyviral'), post_type_archive_title('', false));
     } elseif (is_tax()) {
         $tax = get_taxonomy(get_queried_object()->taxonomy);
         /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
         $title = sprintf(__('%1$s: %2$s', 'sociallyviral'), $tax->labels->singular_name, single_term_title('', false));
     } else {
         $title = __('Archives', 'sociallyviral');
     }
     /**
      * Filter the archive title.
      *
      * @param string $title Archive title to be displayed.
      */
     $title = apply_filters('get_the_archive_title', $title);
     if (!empty($title)) {
         echo $before . $title . $after;
     }
 }
开发者ID:bigpopakap,项目名称:clickworthy,代码行数:43,代码来源:template-tags.php

示例9: wolf_breadcrumbs_get_category_links

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;
}
开发者ID:joffcrabtree,项目名称:Wolf,代码行数:30,代码来源:breadcrumbs.php

示例10: perfect_title

/**
 * 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>';
}
开发者ID:nishant368,项目名称:newlifeoffice-new,代码行数:32,代码来源:custom.php

示例11: mh_page_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();
     }
 }
开发者ID:davidHuanghw,项目名称:david_blog,代码行数:26,代码来源:mh-custom-functions.php

示例12: warrior_archive_title

 function warrior_archive_title()
 {
     global $wp_query;
     $title = '';
     if (is_category()) {
         $title = sprintf(__('%s <span>Category Archives</span>', 'familia'), single_cat_title('', false));
     } elseif (is_tag()) {
         $title = sprintf(__('%s <span>Tag Archives</span>', 'familia'), single_tag_title('', false));
     } elseif (get_post_format()) {
         $title = sprintf(__('Post Format: %s', 'familia'), get_post_format_string(get_post_format()));
     } elseif (is_day()) {
         $title = sprintf(__('%s <span>Daily Archives</span>', 'familia'), date_i18n('d', strtotime(get_the_date('Y-m-d'), false)));
     } elseif (is_month()) {
         $title = sprintf(__('%s <span>Monthly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false)));
     } elseif (is_year()) {
         $title = sprintf(__('%s <span>Yearly Archives</span>', 'familia'), date_i18n('F', strtotime(get_the_date('Y-m-d'), false)));
     } elseif (is_author()) {
         $author = get_user_by('slug', get_query_var('author_name'));
         $title = sprintf(__('%s <span>Author Archives</span>', 'familia'), get_the_author_meta('display_name', $author->ID));
     } elseif (is_search()) {
         if ($wp_query->found_posts) {
             $title = sprintf(__('Search Results for: "%s"', 'familia'), esc_attr(get_search_query()));
         } else {
             $title = sprintf(__('No Results for: "%s"', 'familia'), esc_attr(get_search_query()));
         }
     } elseif (is_404()) {
         $title = __('Not Found', 'familia');
     } elseif (is_home() || is_front_page() || is_single()) {
         $title = '';
     } else {
         $title = __('Blog', 'familia');
     }
     return $title;
 }
开发者ID:TakenCdosG,项目名称:chefs_blog,代码行数:34,代码来源:theme-functions.php

示例13: bavota_breadcrumbs

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');
    }
}
开发者ID:jonbrown21,项目名称:JBD-Wordpress-Theme,代码行数:32,代码来源:functions.php

示例14: ubik_title_archives

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);
}
开发者ID:synapticism,项目名称:ubik-title,代码行数:31,代码来源:ubik-title-core.php

示例15: d7_get_page_title

/**
 * Page title used in the content area of each page. Note this is kinda legacy.
 * Could be replaced with wp_title().
 *
 * @package d7
 * @subpackage boilerplate-theme
 *
 * @return string The page title
 *
 */
function d7_get_page_title()
{
    $title = '';
    if (is_category()) {
        $title .= single_cat_title("", false);
    } elseif (is_tag()) {
        $title .= __('Content tagged: ', get_bloginfo('name')) . single_tag_title("", false);
    } elseif (is_day()) {
        $title .= __('Archive for ', get_bloginfo('name')) . get_the_time('F jS, Y');
    } elseif (is_month()) {
        $title .= __('Archive for', get_bloginfo('name')) . ' ' . get_the_time('F, Y');
    } elseif (is_year()) {
        $title .= __('Archive for', get_bloginfo('name')) . ' ' . get_the_time('Y');
    } elseif (is_search()) {
        $title .= __('Search results', get_bloginfo('name'));
        if (isset($_GET['s'])) {
            $title .= ' ' . __('for', get_bloginfo('name')) . ' <span class="search_term">&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;
}
开发者ID:nathansh,项目名称:nathansh.com-theme,代码行数:39,代码来源:page_title.php


注:本文中的single_tag_title函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。