2012-08-16 75 views
0

網站標題未顯示在瀏覽器標題欄中。未在瀏覽器標題欄中顯示的WordPress標題

我在瀏覽器中看到過頁面源代碼,並注意到標籤正在重複。這可能是一個問題。我無法找到重複。

這是我的header.php

<!DOCTYPE html> 
<!--[if IE 6]> 
<html id="ie6" <?php language_attributes(); ?>> 
<![endif]--> 
<!--[if IE 7]> 
<html id="ie7" <?php language_attributes(); ?>> 
<![endif]--> 
<!--[if IE 8]> 
<html id="ie8" <?php language_attributes(); ?>> 
<![endif]--> 
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!--> 
<html <?php language_attributes(); ?>> 
<!--<![endif]--> 
<head> 
<meta charset="<?php bloginfo('charset'); ?>" /> 
<meta name="viewport" content="width=device-width" /> 

<title><?php 

    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', 'oscar'), max($paged, $page)); 

    ?></title> 
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" /> 
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'> 

<?php 

    if (is_singular() && get_option('thread_comments')) 
     wp_enqueue_script('comment-reply'); 

    wp_head(); 

?> 

</head> 

<body <?php body_class(); ?>> 
+0

另外我正在調用<?php get_header(); ?>在index.php中的功能,並且沒有或標籤。 – Bilal 2012-08-16 07:21:28

回答

1

問題是,Wordpress試圖打印錯誤或警告消息。但是'WP_DEBUG'WP_CONFIG.PHP中是錯誤的。 我只是讓define('WP_DEBUG', false);define('WP_DEBUG', true);

它顯示了一些警告消息。

+0

這仍然沒有解釋你的雙'html'標籤 – janw 2012-08-16 08:31:42

1

看看你的源代碼的代碼,你有2 doctypeshtmlhead,bodytitle標籤。 你需要找出那些來自哪裏。 可能在<?php get_header(); ?>部分上方有html標籤。

它是你自己的主題嗎?

更新
找出停用所有插件的原因。
如果這有助於再次逐個打開它們,看看是哪一個。

如果這沒有幫助。關閉fucntions.php(現在重命名)。
如果這無助於我們提供主題中所有(php)文件的列表。

+0

是的,這是我自己的主題。 上面沒有html <?php get_header();?> – Bilal 2012-08-16 07:29:13

+0

您是否安裝了Yoast? – SMacFadyen 2012-08-16 08:05:15

+0

@SMacFadyen我在源代碼中看不到那個問題 – janw 2012-08-16 08:32:26

0

的原因不能在你的頁面顯示標題正是這一點 - 有2 冠軍標籤,並關閉標籤的兩倍。這意味着,或者某個插件包含每個頁面中的內容,或者您​​在PHP中使用自動準備結束文件。在你的「php.ini」配置文件中檢查這些行:

; Automatically add files before PHP document. 
; http://php.net/auto-prepend-file 
auto_prepend_file = 

; Automatically add files after PHP document. 
; http://php.net/auto-append-file 
auto_append_file = 
+0

問題是 wp_enqueue_script被稱爲錯誤。直到wp_enqueue_scriptsadmin_enqueue_scriptsinit掛鉤之前,腳本和樣式不應註冊或排隊。有關更多信息,請參閱Debugging in WordPress。 (這條消息是在3.3版本中添加的。)在C:\ wamp \ www \ wordpress \ wp-includes \ functions.php上2748行 如何解決這個問題? – Bilal 2012-08-16 10:36:07

相關問題