企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
【4.页面、文章样式选择显示】 页面默认模板为header.php+空白+footer.php 设置页面模板,需要在指定页面加入如下代码: ~~~ <?php /* template name:模板名字 */ ?> ~~~ 使用post types增加了文章的展示类型,提取对应页面的命名方法: `single-slugname.php` 举例,Post Type Slug是sample,那么对应post命名为: `single-sample.php` post types插件: https://wordpress.org/plugins/custom-post-type-ui/ 【`get_template_part();`的使用】 ~~~ <?php get_template_part( 'nav' ); // Navigation bar (nav.php) ?> <?php get_template_part( 'nav', '2' ); // Navigation bar #2 (nav-2.php) ?> <?php get_template_part( 'nav', 'single' ); // Navigation bar to use in single pages (nav-single.php) ?> ~~~ 参考: https://developer.wordpress.org/reference/functions/get_template_part/ https://jingyan.baidu.com/article/8065f87f8f175d2330249849.html