2016-05-31 68 views
0

我對wordpress比較陌生。我有一個問題,wp_title在我網站的所有頁面上都顯示空白。wp_title在wordpress站點的所有頁面上都是空白的

我已經看到幾篇文章討論頁面標題不顯示在索引頁面上,但還沒有發現任何與它相關的內容,而不是在網站的所有頁面上顯示。

使用下面的代碼,我的標題標籤呈現與網站的名稱,但沒有網頁名稱:

<title> 
    <?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"; 
</title> 

就像我說的,我是新來使用Wordpress所以有很高的機會,我m在這裏丟失的東西真的很明顯...

+0

你有沒有什麼有趣的日誌? – Lee

+0

我剛剛檢查 - 什麼也沒有,@Lee –

+0

最後通過安裝Yoast SEO插件來解決這個問題,事後看來對我的情況來說更好。無法解釋爲什麼wp_title沒有顯示,但至少現在有效 –

回答

0

你爲什麼不使用? printf(get_bloginfo('url')),printf(get_bloginfo('description'),printf('sitename')。

+0

這並不返回頁面姓名,例如'關於','聯繫人','博客'等。 –

相關問題