具有不同页眉 and/or 页脚的 WordPress 动态内容

WordPress Dynamic Contents with Different Header and/or Footer

我正在寻找一种解决方案来创建具有不同页眉和页脚内容(文本或图片不同)的 WordPress 页面。

假设我的一个页面有一个 link 域。com/firstcontent,我想创建另一个具有不同页眉和页脚内容的页面,这可能就像 domain.com/secondbranch/firstcontent

但是,我不想复制整个网站,因为我只想更改 'some' 个页面的页眉和页脚。

WP 页面的页眉和页脚基本上包含在 page.php..

因此,如果您想为特定页面添加一些不同的页眉和页脚,那么

if(get_the_ID() == 12){
get_header('12');
}

and a header-12.php file should be created in the active theme folder. Same goes for footer

通常有 get_header() 调用 header.php