2014-10-27 260 views
0

我正在工作网站here。标签中网站的标题标签显示最新发布的帖子的标题。标题标签显示最新帖子标题

所述的header.php具有以下

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

我将其替换为

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

仍然其展示。

我已经安装了All In One SEO Pack plugin.is可能是原因。如果是,有没有什么方法可以在不停用插件的情况下进行更正。请帮助。 谢谢!

编辑:

我的header.php包括

<?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" />' . "\n"; 
} else { 
    echo '<meta name="robots" content="noindex, follow" />' . "\n"; 
} 
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" /> [email protected] </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"> 
+2

清除缓存的一次检查 – 2014-10-27 09:31:13

+0

试试这个https://wordpress.org/support/topic/blog-page-title-changed-last-blog-post – Gunaseelan 2014-10-27 10:04:25

+0

@gunaseelan:为什么我们在站点标题中使用h1标签..没有意义的权利? – Melvin 2014-10-27 12:53:54

回答

1

使用is_front_page()代替is_home()

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

没有。 。它没有工作 – Melvin 2014-10-28 04:22:05

+0

@Melvin请提供您的完整header.php代码 – Gunaseelan 2014-10-28 05:09:15

+0

我已经通过添加它添加了我的qn – Melvin 2014-10-28 05:23:53