Wordpress and PHP includes


Wordpress and PHP includes

如果我想在wordpress主题的某个页面上使用自己的HTML,我该怎么做?

请告知代码应该去哪里

如果我可以使用原始HTML或PHP包括。

如果你想把HTML放在主页内容中,只需使用WordPress的文本编辑器(http://www.wpbeginner.com/glossary/text-editor/)。标题&页脚将在主题的header.phpfooter.php文件中进行修改。它们将位于的目录应该是CCD_ 3。如果你只想在特定的页面上修改页眉和页脚,你需要使用WordPress中内置的is_page()函数(https://codex.wordpress.org/Function_Reference/is_page)。

将页眉或页脚修改限制在特定页面的示例:

<?php if( is_page( 42 ) !== false ) { ?>
    <!-- HTML that should only appear on page with id of 42. -->
<?php } ?>