wordpress 如何让文章页标题栏只显示文章标题,去掉后面的站点标题

如题所述

哎,这个最好得根据你的模板来说,不同的模板可能标题的显示方式都不一样。
这个东西定义在主题下得header.php中。

以默认的twenty-ten为例。
在<title>之后,加入
<?php if(is_single()){ ?> // 判断当前页面是否为文章页
<?php wp_title( '', true, 'right' ); ?> // 引号均为单引号
<?php } ?>
这时候后面应该就是原内容了,
需要把原内容开头的<?php 后面加上if(!is_single()){ ?>变成:
<?php if(!is_single()){ ?>
再在后续内容前加上<?php
在结尾处的 ?>之后还要加一句<?php } ?>

全部代码:
<title>
<?php if(is_single()){ ?>
<?php wp_title( '', true, 'right' ); ?>
<?php } ?>
<?php if(!is_single()){ ?>
<?php
/*
* Print the <title> tag based on what is being viewed.
*/
global $page, $paged;

wp_title( '|', true, 'right' );

// Add the blog name.
bloginfo( 'name' );

// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";

// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );?>

<?php } ?>
</title>
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网