2017-02-18 21 views
0

特定頁面我做了一個自定義的PHP頭文件,並把它命名爲header-membersclub.php,取而代之的是這個代碼的默認標題行中page.php如何創建一個單獨的頭在WordPress的

<?php 
if(is_page(7)) { 
    get_header('membersclub'); 
} else { 
    get_header(); 
} 
wp_head(); 
?> 

但由於某種原因它不工作。有人可以幫助我嗎?我不知道我做錯了什麼。

+1

更具體與您的問題,包括代碼示例 –

+0

提供屏幕截圖也因爲它給出了一個更好的主意,你要實現這一點,你的整個WordPress的佈局結構。 – user7568042

+0

嘗試在http://wordpress.stackexchange.com/上發佈它 – Jadeye

回答

1

我更新了你的代碼:

<?php 
if(is_page($post->ID)) { //checking the current post not only 7 
    get_header('membersclub'); 
} else { 
    get_header(); 
} 
?> 

我刪除wp_head();那是後話,應該是裏面<head>

相關問題