2013-03-17 65 views
0

在我的WordPress的網站上,當我點擊我的投資組合類別,它顯示標題'博客檔案'這不是什麼我想要。WordPress的投資組合頁面使用標題'博客檔案',我想它說'投資組合'

我想要一個'Portfolio'的標題。所以我找到了archive.php的模板文件,它基本上說如果變量is_Day,is_Month或is_Year已設置,那麼顯示相關的存檔標題,否則顯示'Blog Archive',看下面的代碼

<h2> 
    <?php if (is_day()) : /* if the daily archive is loaded */ ?> 
    <?php printf(__('Daily Archives: <span>%s</span>'), get_the_date()); ?> 
<?php elseif (is_month()) : /* if the montly archive is loaded */ ?> 
    <?php printf(__('Monthly Archives: <span>%s</span>'), get_the_date('F Y')); ?> 
<?php elseif (is_year()) : /* if the yearly archive is loaded */ ?> 
    <?php printf(__('Yearly Archives: <span>%s</span>'), get_the_date('Y')); ?> 
<?php else : /* if anything else is loaded, ex. if the tags or categories template is missing this page will load */ ?> 
    <?php _e('Blog Archive', 'theme5820'); ?> 
<?php endif; ?> 
</h2> 

在我看來,投資組合頁面正在使用檔案模板來顯示帖子,因爲上面說'如果還有其他東西被加載,例如。如果標籤或類別模板丟失,該頁面將會加載'

所以我的問題是真的,只要將'Blog Archive'更改爲投資組合,或者我應該爲投資組合類別創建一個頁面投資組合頁面本身顯示標題正常。

乾杯,豐富:)

回答

0

首先,看看是否有一個category.php模板。如果是這樣,請將其複製到category-portfolio.php;如果沒有,請將archive.php複製到category-portfolio.php。然後編輯新文件並刪除不需要的任何標題代碼(如果category.php代碼可能與archive.php稍有不同),因爲它對於類別顯示更具體。當您選擇Portfolio類別時,WP將自動使用新模板。 (我假設這是你自己的主題,如果沒有,創建一個子主題,把新文件放在那裏,然後選擇它,這樣,如果你的當前主題被升級,你就不會被燒掉)。