对WordPress主题使用多个自定义标题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了对WordPress主题使用多个自定义标题相关的知识,希望对你有一定的参考价值。
The first thing to do is to create header files. Create as many different headers as you want. In this exemple, I have created 3 custom headers from my theme default file header.php, names headercontact.php, headergallery.php and headerdefault.php.By using the php include() function and WordPress conditional tags, we can define custom headers easily.
Replace the content of your header.php file with the following code:
<?php if (is_page('contact')){ <?php include(TEMPLATEPATH.'/headercontact.php'); ?> } elseif (is_page('gallery')){ <?php include(TEMPLATEPATH.'/headergallery.php'); ?> } else { <?php include(TEMPLATEPATH.'/headerdefault.php'); ?> } ?>
以上是关于对WordPress主题使用多个自定义标题的主要内容,如果未能解决你的问题,请参考以下文章
为WordPress的论文主题添加多个压缩页面,并使用论文1.8的自定义过滤器