-3

我使用 seo 验证器检查我的网站,但它说我的网站没有网站标题。我在下面有这些标题代码:

<head profile="http://gmpg.org/xfn/11">
<meta name="google-site-verification" content="RR4KnVDyxKEeBxQg8Qwphb0E2RuBTxVE3y-NrLS_tsw" />
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; <?php } ?> <?php wp_title(); ?></title>
    <meta name="Description" content="Davao Property For Sale is the desired partner of Filipino families in finding and owning a HOME in Davao City, Philippines every step of the way." />
    <meta name="Keywords" content="Davao City, real estate, House for sale, rush house, brand new, ready for occupancy, Davao Property" />

请帮忙!

4

2 回答 2

2

尝试这个:

<title>
<?php 

    $title = bloginfo('name');

    if ( is_single() ) { 
       $title .= '&raquo;'; 
    } 

    $title .= wp_title(); 

    echo $title;
  ?>
 </title>

这个想法是使用变量 $title 来连接你的标题,最后用函数 echo 编写它。

于 2012-11-07T01:49:15.990 回答
0
<title><?php echo bloginfo('name').(is_single()?' &raquo;':'').' '.wp_title() ?></title>

或者

<title><?= bloginfo('name').(is_single()?' &raquo;':'').' '.wp_title() ?></title>

或者

<?php $pageT = bloginfo('name');
if (is_single()) $pageT .= ' &raquo;';
$pageT .= ' ' . wp_title(); ?>
<title><?php echo $pageT ?></title>

不过,还有一些其他的可能性可以写这个。

于 2012-11-07T01:57:42.227 回答