douzhaolu4780
2014-10-27 09:29
浏览 91
已采纳

标题标签显示最新的帖子标题

I am working a site here . the title tag of the site in tab shows the title of the latest published post .

the header.php has the following

<title>
    <?php if (is_home()) { bloginfo('name'); ?>
    <?php } else if (is_category() || is_page() ||is_single()) { ?> 
    <?php } ?>
    <?php wp_title(''); ?>
</title>

i replaced it to

<title><?php wp_title( '|', true, 'right' ); ?></title>

still its showing.

i have installed All In One SEO Pack plugin.is that could be the reason.If yes,is there any way to correct it without deactivating the plugin.Please help. Thanks!!

Edit:

my header.php includes

<?php
global $k_options; 
?>
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
<html  xmlns="http://www.w3.org/1999/xhtml" 
version="XHTML+RDFa 1.0"
xmlns:og="http://ogp.me/ns#"
xml:lang="en-US">



<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

<title>
   <?php if (is_home()) { bloginfo('name'); ?>
   <?php } else if (is_category() || is_page() ||is_single()) { ?> 
   <?php } ?>
   <?php wp_title(''); ?>
</title>


<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS2 Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />


<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/prettyPhoto/css/prettyPhoto.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

<?php if($k_options['general']['whichdesign'] == 5){ ?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style5.css" type="text/css" media="screen" />
<?php } else if($k_options['general']['whichdesign'] == 4){ ?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style4.css" type="text/css" media="screen" />
<?php } else if($k_options['general']['whichdesign'] == 3){ ?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style3.css" type="text/css" media="screen" />
<?php } else if($k_options['general']['whichdesign'] == 2){ ?>
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style2.css" type="text/css" media="screen" />
<?php } else {?> 
<link rel="stylesheet" href="<?php echo bloginfo('template_url'); ?>/css/style1.css" type="text/css" media="screen" />
<?php } 

if ( is_singular() ) wp_enqueue_script( 'comment-reply' );

if ( ( is_single() || is_page() || is_home() ) && ( !is_paged() ) ) {
    echo '<meta name="robots" content="index, follow" />' . "
";
} else {
    echo '<meta name="robots" content="noindex, follow" />' . "
";
}
wp_head(); ?>

<meta name="twicet1" content="<?php echo $k_options['mainpage']['autorotate'];?>" />
<meta name="twicet2" content="<?php echo $k_options['mainpage']['auto_duration']; ?>" />
<meta name="twicet3" content="<?php echo bloginfo('template_url'); ?>" />
<meta name="twicet4" content="<?php echo $k_options['general']['whichdesign']; ?>" />
<meta name="twicet5" content="<?php echo $k_options['mainpage']['ticker_auto_duration']; ?>" />
<meta name="SKYPE_TOOLBAR" content ="SKYPE_TOOLBAR_PARSER_COMPATIBLE"/>

<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="">
<meta name="twitter:title" content="Timetable Management">
<meta name="twitter:description" content="‘e- Timetable’ is a great tool designed for making it easy to allot work both teacher wise and class wise. It is an easy and robust software that makes timetable management simple.">
<meta name="twitter:creator" content="">
<meta name="twitter:image:src" content="">
<meta name="twitter:domain" content="">
<meta name="twitter:app:name:iphone" content="">
<meta name="twitter:app:name:ipad" content="">
<meta name="twitter:app:name:googleplay" content="">
<meta name="twitter:app:url:iphone" content="">
<meta name="twitter:app:url:ipad" content="">
<meta name="twitter:app:url:googleplay" content="">
<meta name="twitter:app:id:iphone" content="">
<meta name="twitter:app:id:ipad" content="">
<meta name="twitter:app:id:googleplay" content="">


<!--[if IE 6]>
<script type='text/javascript' src='<?php echo get_bloginfo('template_url'); ?    >/js/dd_belated_png.js'></script>
<script>DD_belatedPNG.fix('.ie6fix');</script>
<![endif]-->
<!--google code----->
 <script type='text/javascript'>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-46725466-1', 'edsys.in');
  ga('send', 'pageview');

</script>

<style type='text/css'>
span.skype_pnh_container {display:none !important;} span.skype_pnh_print_container     {display:inline !important;}
</style>
</head>

<?php $body_id = is_front_page() ? 'frontpage' : 'subpage'; ?>

<body id="<?php echo $body_id; ?>">
<div class="wrap_all">
<div id="top">
<div id="head">
       <h1 class='logo'><a href="<?php echo get_settings('home'); ?>" ><?php bloginfo('name'); ?></a></h1>
 <div class='tagline'>
  <div> <span> <img src="<?php echo bloginfo('template_url'); ?>/images/uk.png" alt="uk" /> +44 793 743 5674 </span> <span> <img src="<?php echo bloginfo('template_url'); ?>/images/usa.png" alt="usa" /> +1 786 623 4635 </span>  <span> <img src="<?php echo bloginfo('template_url'); ?>/images/in.png" alt="in" /> +91 471 245 9995 </span> <span style="color:#A0A0A0 !important;"> 
<img src="<?php echo bloginfo('template_url'); ?>/images/mail.png" alt="mail" /> info@edsys.in </span> </div>
 <h3><?php bloginfo('description'); ?></h3>

 </div>

       <?php wp_nav_menu(array( 'menu'  =>  'custom_menu',
                    'fallback_cb'=> 'kriesi_default_menu',
                    'container' => 'div',
                    'container_class'=>'navwrap',
                    'menu_id'      => 'nav'
       )); ?>



         <?php if(!is_front_page() && (class_exists('simple_breadcrumb'))){ $bc = new simple_breadcrumb; }?>

  </div><!-- end head-->

    <div id="main">
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dongqiong8021 2014-10-27 14:23
    最佳回答

    Use is_front_page() instead of is_home()

    <title>
           <?php if (is_front_page()) { bloginfo('name'); ?>
           <?php } else if (is_category() || is_page() ||is_single()) { ?> 
           <?php } ?>
           <?php wp_title(''); ?>
    </title>
    
    评论
    解决 无用
    打赏 举报