本文整理汇总了PHP中wp_title函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_title函数的具体用法?PHP wp_title怎么用?PHP wp_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_title函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: title
function title()
{
if (is_category()) {
echo 'Category Archive for "';
single_cat_title();
echo '" | ';
bloginfo('name');
} elseif (is_tag()) {
echo 'Tag Archive for "';
single_tag_title();
echo '" | ';
bloginfo('name');
} elseif (is_archive()) {
wp_title('');
echo ' Archive | ';
bloginfo('name');
} elseif (is_search()) {
echo 'Search for "' . wp_specialchars($s) . '" | ';
bloginfo('name');
} elseif (is_home() || is_front_page()) {
bloginfo('name');
echo ' | ';
bloginfo('description');
} elseif (is_404()) {
echo 'Error 404 Not Found | ';
bloginfo('name');
} elseif (is_single()) {
wp_title('');
} else {
echo wp_title(' | ', false, right);
bloginfo('name');
}
}
开发者ID:indee,项目名称:indee-website,代码行数:33,代码来源:globals.func.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: get_wp_title_rss
/**
* Retrieve the blog title for the feed title.
*
* @package WordPress
* @subpackage Feed
* @since 2.2.0
* @uses apply_filters() Calls 'get_wp_title_rss' hook on title.
* @uses wp_title() See function for $sep parameter usage.
*
* @param string $sep Optional.How to separate the title. See wp_title() for more info.
* @return string Error message on failure or blog title on success.
*/
function get_wp_title_rss($sep = '»') {
$title = wp_title($sep, false);
if ( is_wp_error( $title ) )
return $title->get_error_message();
$title = apply_filters('get_wp_title_rss', $title);
return $title;
}
开发者ID:pauEscarcia,项目名称:AIMM,代码行数:19,代码来源:FEED.PHP
示例4: df_page_title
/**
* Output the site page title
* @access public
* @subpackage Framework/Head
* @return void
*/
function df_page_title($title)
{
$title = '<title>' . get_bloginfo('name') . ' | ';
$title .= is_home() ? get_bloginfo('description') : wp_title('', false);
$title .= '</title>';
echo apply_filters('df_page_title', $title);
}
开发者ID:WordPress-Phoenix,项目名称:div-framework,代码行数:13,代码来源:df-filters.php
示例5: wp_head
public function wp_head()
{
if (is_question()) {
global $wp;
echo '<link href="' . home_url(add_query_arg(array(), $wp->request)) . '" title="' . wp_title('|', false, 'right') . '" type="application/rss+xml" rel="alternate">';
}
}
开发者ID:jessor,项目名称:anspress,代码行数:7,代码来源:anspress-main.php
示例6: rt_breadcrumb
function rt_breadcrumb($gecerli_sayfa)
{
if (is_page()) {
$ust_id = $gecerli_sayfa->post_parent;
$yeni_sorgu = get_post($ust_id);
if ($yeni_sorgu->post_parent) {
rt_breadcrumb($yeni_sorgu);
echo " \\ ";
}
echo "<a href=\"" . get_permalink($yeni_sorgu->ID) . "\" title=\"\" >" . get_the_title($yeni_sorgu->ID) . "</a>";
} elseif (is_single() || is_category() && !is_archive()) {
$ust_id = $gecerli_sayfa->post_parent;
$yeni_sorgu = get_post($ust_id);
$kategori = get_the_category($yeni_sorgu->ID);
$ID = $kategori[0]->cat_ID;
$ayrac = " \ ";
echo get_category_parents($ID, TRUE, $ayrac, FALSE);
if ($yeni_sorgu->post_parent) {
rt_breadcrumb($yeni_sorgu);
if (!is_category()) {
echo " \\ ";
}
}
if (is_single()) {
echo "<a href=\"" . get_permalink($yeni_sorgu->ID) . "\" title=\"\" >" . get_the_title($yeni_sorgu->ID) . "</a>";
}
} else {
echo wp_title('');
}
}
开发者ID:xiaoxiaoleo,项目名称:yihe,代码行数:30,代码来源:functions.php
示例7: reactor_do_reactor_head
/**
* Site meta, title, and favicon
* in header.php
*
* @since 1.0.0
*/
function reactor_do_reactor_head()
{
?>
<meta charset="<?php
bloginfo('charset');
?>
" />
<title><?php
wp_title('|', true, 'right');
?>
</title>
<!-- google chrome frame for ie -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- mobile meta -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<?php
$favicon_uri = reactor_option('favicon_image') ? reactor_option('favicon_image') : get_template_directory_uri() . '/favicon.ico';
?>
<link rel="shortcut icon" href="<?php
echo $favicon_uri;
?>
">
<link rel="pingback" href="<?php
bloginfo('pingback_url');
?>
">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'>
<?php
}
开发者ID:aaronfrey,项目名称:PepperLillie-Cambridge,代码行数:41,代码来源:content-header.php
示例8: A2A_SHARE_SAVE_link_vars
function A2A_SHARE_SAVE_link_vars($linkname = false, $linkurl = false, $linkmedia = false, $use_current_page = false)
{
global $post;
// Set linkname
if (!$linkname) {
if ($use_current_page) {
$linkname = is_home() || is_front_page() ? get_bloginfo('name') : rtrim(wp_title('', false, 'right'));
} elseif (isset($post)) {
$linkname = html_entity_decode(strip_tags(get_the_title($post->ID)), ENT_QUOTES, 'UTF-8');
} else {
$linkname = '';
}
}
$linkname_enc = rawurlencode($linkname);
// Set linkurl
if (!$linkurl) {
if ($use_current_page) {
$linkurl = esc_url_raw((is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
} elseif (isset($post)) {
$linkurl = get_permalink($post->ID);
} else {
$linkurl = '';
}
}
$linkurl_enc = rawurlencode($linkurl);
// Set linkmedia (only applies to services that explicitly accept media; Pinterest does, most do not)
$linkmedia_enc = !empty($linkmedia) ? rawurlencode($linkmedia) : false;
return compact('linkname', 'linkname_enc', 'linkurl', 'linkurl_enc', 'linkmedia', 'linkmedia_enc');
}
开发者ID:AndyA,项目名称:River,代码行数:29,代码来源:add-to-any.php
示例9: __construct
/**
* Initializes this object to default data
*/
public function __construct()
{
$tempate_directory_uri = get_template_directory_uri();
$title = get_bloginfo('name') . wp_title(null, false);
$description = get_bloginfo('description');
$this->set_title($title)->set_meta_tag(array('name' => 'description', 'content' => $description))->set_meta_tag(array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'))->set_charset(get_bloginfo('charset'))->set_link(array('rel' => 'shortcut icon', 'href' => "{$tempate_directory_uri}/images/favicon.png"));
}
开发者ID:setola,项目名称:wordpress-theme-utils-classes,代码行数:10,代码来源:HeadHelper.class.php
示例10: breadcrumbs
function breadcrumbs()
{
$theFullUrl = $_SERVER["REQUEST_URI"];
$urlArray = explode("/", $theFullUrl);
//echo 'You Are Here: <a href="/">Home</a>';
echo "<div class='breadcrumbs_div'>";
echo "<div class='breadcrumbs'><ul>";
while (list($j, $text) = each($urlArray)) {
$dir = '';
if ($j > 1) {
$i = 1;
while ($i < $j) {
$dir .= '/' . $urlArray[$i];
$text = $urlArray[$i];
$i++;
}
if ($j < count($urlArray) - 1) {
echo ' <li><a href="' . $dir . '">' . str_replace("-", " ", $text) . '</a></li>';
}
}
}
echo "</ul></div>";
echo "<div class='current'>" . wp_title('', false) . '<img class="current_img" width="11" height="17" border="0" src="/wp-content/themes/crikey/img/left_arrow.png" alt=">">' . "</div></div>";
echo '<div class="clear"></div>';
}
开发者ID:nadula,项目名称:CodeSamples-PHP-Wordpress,代码行数:25,代码来源:functions.php
示例11: perfect_title
/**
* Prints better page title
*/
function perfect_title()
{
echo '<title>';
if (function_exists('is_tag') && is_tag()) {
single_tag_title(__('Tag Archive for') . '"');
$output .= '" - ';
} elseif (is_archive()) {
wp_title('');
echo __('Archive') . ' - ';
} elseif (is_search()) {
echo __('Search for') . '"' . esc_html($s) . '" - ';
} 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
示例12: tarski_doctitle
/**
* Returns the document title.
*
* The order (site name first or last) can be set on the Tarski Options page.
* While the function ultimately returns a string, please note that filters
* are applied to an array! This allows plugins to easily alter any aspect
* of the title. For example, one might write a plugin to change the separator.
*
* @since 1.5
* @deprecated 3.2.0
*
* @param string $sep
* @return string
*
* @hook filter tarski_doctitle
* Filter document titles.
*/
function tarski_doctitle($sep = '·')
{
_deprecated_function('wp_title', '3.2.0');
$site_name = get_bloginfo('name');
$content = trim(wp_title('', false));
if (is_404()) {
$content = sprintf(__('Error %s', 'tarski'), '404');
} elseif (get_option('show_on_front') == 'posts' && is_home()) {
$content = get_bloginfo('description', 'display');
} elseif (is_search()) {
$content = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query()));
} elseif (is_month()) {
$content = single_month_title(' ', false);
} elseif (is_tag()) {
$content = multiple_tag_titles();
}
$elements = strlen($content) > 0 ? array('site_name' => $site_name, 'separator' => $sep, 'content' => $content) : array('site_name' => $site_name);
if (get_tarski_option('swap_title_order')) {
$elements = array_reverse($elements, true);
}
// Filters should return an array
$elements = apply_filters('tarski_doctitle', $elements);
// But if they don't, it won't try to implode
if (is_array($elements)) {
$doctitle = implode(' ', $elements);
}
echo $doctitle;
}
开发者ID:aleksking,项目名称:sherrill,代码行数:45,代码来源:deprecated.php
示例13: add_scripts
/**
* Enqueue scripts and styles
*/
function add_scripts()
{
if (empty($GLOBALS['posts']) || !is_array($GLOBALS['posts'])) {
return;
}
foreach ($GLOBALS['posts'] as $p) {
if (has_shortcode($p->post_content, 'recipe')) {
$this->scripts_and_style_included = true;
break;
}
}
if (!$this->scripts_and_style_included) {
return;
}
if (is_rtl()) {
wp_enqueue_style('jetpack-recipes-style', plugins_url('/css/rtl/recipes-rtl.css', __FILE__), array(), '20130919');
} else {
wp_enqueue_style('jetpack-recipes-style', plugins_url('/css/recipes.css', __FILE__), array(), '20130919');
}
wp_enqueue_script('jetpack-recipes-printthis', plugins_url('/js/recipes-printthis.js', __FILE__), array('jquery'), '20131230');
wp_enqueue_script('jetpack-recipes-js', plugins_url('/js/recipes.js', __FILE__), array('jquery', 'jetpack-recipes-printthis'), '20131230');
$title_var = wp_title('|', false, 'right');
$print_css_var = plugins_url('/css/recipes-print.css', __FILE__);
wp_localize_script('jetpack-recipes-js', 'jetpack_recipes_vars', array('pageTitle' => $title_var, 'loadCSS' => $print_css_var));
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:28,代码来源:recipe.php
示例14: tarski_doctitle
/**
* tarski_doctitle() - Returns the document title.
*
* The order (site name first or last) can be set on the Tarski Options page.
* While the function ultimately returns a string, please note that filters
* are applied to an array! This allows plugins to easily alter any aspect
* of the title. For example, one might write a plugin to change the separator.
* @since 1.5
* @param string $sep
* @return string $doctitle
* @hook filter tarski_doctitle
* Filter document titles.
*/
function tarski_doctitle($sep = '·')
{
$site_name = get_bloginfo('name');
if (is_404()) {
$content = __(sprintf('Error %s', '404'), 'tarski');
} elseif (get_option('show_on_front') == 'posts' && is_home()) {
if (get_bloginfo('description')) {
$content = get_bloginfo('description');
}
} elseif (is_search()) {
$content = sprintf(__('Search results for %s', 'tarski'), attribute_escape(get_search_query()));
} elseif (is_month()) {
$content = single_month_title(' ', false);
} elseif (is_tag()) {
$content = multiple_tag_titles();
} else {
$content = trim(wp_title('', false));
}
if ($content) {
$elements = array('site_name' => $site_name, 'separator' => $sep, 'content' => $content);
} else {
$elements = array('site_name' => $site_name);
}
if (get_tarski_option('swap_title_order')) {
$elements = array_reverse($elements, true);
}
// Filters should return an array
$elements = apply_filters('tarski_doctitle', $elements);
// But if they don't, it won't try to implode
if (check_input($elements, 'array')) {
$doctitle = implode(' ', $elements);
}
echo $doctitle;
}
开发者ID:alicam,项目名称:vanilla-theme,代码行数:47,代码来源:template_helper.php
示例15: set_cookie
public static function set_cookie($data = '')
{
$data = wp_parse_args($data, array('query' => json_encode($GLOBALS['wp_query']->query), 'url' => (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'title' => trim(wp_title(self::SEP, false, 'left'))));
foreach ($data as $key => $value) {
setcookie(self::get_name($key), $value, 0, '/');
}
}
开发者ID:badfeather,项目名称:wp-smarter-navigation,代码行数:7,代码来源:main.php
示例16: meta_title
function meta_title()
{
if (is_single()) {
single_post_title();
echo ' | ';
bloginfo('name');
} elseif (is_home() || is_front_page()) {
bloginfo('name');
if (get_bloginfo('description')) {
echo ' | ';
bloginfo('description');
get_page_number();
}
} elseif (is_page()) {
single_post_title('');
echo ' | ';
bloginfo('name');
} elseif (is_search()) {
printf(__('有关 %s 的搜索结果:'), '"' . get_search_query() . '"');
get_page_number();
echo ' | ';
bloginfo('name');
} elseif (is_404()) {
_e('404 Not Found', 'Arnold');
echo ' | ';
bloginfo('name');
} else {
wp_title('');
echo ' | ';
bloginfo('name');
get_page_number();
}
}
开发者ID:doio,项目名称:jianux_core,代码行数:33,代码来源:functions.php
示例17: apt_simple_title
function apt_simple_title()
{
if (!is_front_page()) {
echo trim(wp_title('', false)) . " | ";
}
bloginfo('name');
}
开发者ID:keroken,项目名称:wp_jeanet-theme-2.0,代码行数:7,代码来源:functions.php
示例18: title
function title()
{
global $thesis_site, $thesis_pages;
$site_name = get_bloginfo('name');
#wp
$separator = $thesis_site->head['title']['separator'] ? urldecode($thesis_site->head['title']['separator']) : '—';
if (is_home() || is_front_page()) {
#wp
$tagline = get_bloginfo('description');
#wp
$home_title = $thesis_pages->home['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->home['head']['title']))) : "{$site_name} {$separator} {$tagline}";
#wp
if (get_option('show_on_front') == 'page' && is_front_page()) {
#wp
$page_title = get_post_meta(get_option('page_on_front'), 'thesis_title', true);
} elseif (get_option('show_on_front') == 'page' && is_home()) {
#wp
$page_title = get_post_meta(get_option('page_for_posts'), 'thesis_title', true);
}
#wp
$output = $page_title ? trim(wptexturize(strip_tags(stripslashes($page_title)))) : $home_title;
#wp
} elseif (is_category()) {
#wp
global $wp_query;
#wp
$category_title = $thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->categories[$wp_query->query_vars['cat']]['head']['title']))) : single_cat_title('', false);
#wp
$output = $thesis_site->head['title']['branded'] ? "{$category_title} {$separator} {$site_name}" : $category_title;
} elseif (is_tag()) {
global $wp_query;
#wp
$tag_title = $thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title'] ? trim(wptexturize(urldecode($thesis_pages->tags[$wp_query->query_vars['tag_id']]['head']['title']))) : single_tag_title('', false);
#wp
$output = $thesis_site->head['title']['branded'] ? "{$tag_title} {$separator} {$site_name}" : $tag_title;
} elseif (is_search()) {
#wp
$search_title = __('You searched for', 'thesis') . ' “' . attribute_escape(get_search_query()) . '”';
#wp
$output = $thesis_site->head['title']['branded'] ? "{$search_title} {$separator} {$site_name}" : $search_title;
} else {
global $post;
#wp
$custom_title = is_single() || is_page() ? trim(wptexturize(strip_tags(stripslashes(get_post_meta($post->ID, 'thesis_title', true))))) : false;
#wp
$page_title = $custom_title ? $custom_title : trim(wp_title('', false));
#wp
$output = $thesis_site->head['title']['branded'] ? "{$page_title} {$separator} {$site_name}" : $page_title;
}
if (is_home() || is_archive() || is_search()) {
#wp
$current_page = get_query_var('paged');
#wp
if ($current_page > 1) {
$output .= " {$separator} " . __('Page', 'thesis') . " {$current_page}";
}
}
$this->title['title'] = '<title>' . apply_filters('thesis_title', $output, $separator) . '</title>';
#wp #filter
}
开发者ID:JGrubb,项目名称:Almond-Tree,代码行数:60,代码来源:head.php
示例19: getWordpressData
static function getWordpressData() {
/**
* Get all global page data
*/
$blogDataParams = array(
'url', 'wpurl', 'description', 'rdf_url' , 'rss_url', 'rss2_url'
, 'atom_url', 'comments_atom_url', 'comments_rss2_url', 'pingback_url'
, 'stylesheet_url', 'stylesheet_directory', 'template_directory'
, 'template_url', 'admin_email', 'charset', 'html_type', 'version'
, 'language', 'text_direction', 'name'
);
$blogData = array();
foreach($blogDataParams as $blogDataParam) {
$blogData[self::toCamelCase($blogDataParam)] = get_bloginfo($blogDataParam);
}
$blogData = array_merge($blogData, array(
'title' => wp_title(' | ', false, 'right') . get_bloginfo('name'),
'archiveLinksHTML' => wp_get_archives('type=monthly&limit=5&format=link&echo=0'),
'bodyClasses' => self::getEchoFunctionContents('body_class'),
'posts' => array()
));
/**
* Get posts data
*/
while (have_posts()) {
the_post();
$postId = get_the_ID();
// Get category data
$categories = get_the_category();
$categoryNames = array();
foreach($categories as $category) {
array_push($categoryNames, $category->cat_name);
}
// Add all relevant post data to the posts array
array_push(
$blogData['posts'],
array_merge(
get_object_vars(get_post($postId)),
array(
'classes' => get_post_class(),
'comments' => get_comments(array('post_id' => $postId)),
'custom' => get_post_custom(),
'permalink' => get_permalink(),
'categories' => $categories,
'categoryNames' => $categoryNames,
'categoriesStr' => implode(',', $categoryNames)
)
)
);
}
return $blogData;
}
开发者ID:nottrobin,项目名称:rw-theme,代码行数:60,代码来源:SitesUtil.php
示例20: blackoot_render_title
function blackoot_render_title()
{
?>
<title><?php
wp_title('|', true, 'right');
?>
</title><?php
}
开发者ID:Torchwood7,项目名称:torchwood-site,代码行数:8,代码来源:functions.php
注:本文中的wp_title函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论