简体   繁体   English

Wordpress在所有页面上显示页眉和页脚

[英]Wordpress displaying the header and footer on all pages

Is there a way I can make the header and footer appear on all pages without placing get_header(); 有没有一种方法可以使页眉和页脚出现在所有页面上而无需放置get_header();? or get_footer(); 或get_footer(); in each of the separate page files? 在每个单独的页面文件中? Is there something I can do in the loop or somewhere else that automatically does this? 我可以在循环中执行其他操作吗?

You want to show get_header() and get_footer() to all the pages. 您想在所有页面上显示get_header()get_footer() For that you just mention get_header() and get_footer() in each custom template you have created. 为此,您只需在创建的每个自定义模板中提及get_header()get_footer() By default you can place it inside page.php file. 默认情况下,您可以将其放在page.php文件中。

Also if you want to use custom header and custom footer , then you need to create header-custom.php and footer-custom.php file and call them inside any template like the following. 另外,如果要使用自定义标头和自定义页脚,则需要创建header-custom.php和footer-custom.php文件,并在如下所示的任何模板中调用它们。

get_header('custom');
get_footer('custom');

只需将它们放在主题的page.php文件中即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM