【发布时间】:2016-06-09 21:19:52
【问题描述】:
我通过与其他人谈论为什么要在前端页面上加载自定义页面很容易,他告诉我 get_template_part 并且我认为它对于重用代码来说非常棒,因此我遇到了这个函数 get_template_part。但是他用它在首页加载了我所有的自定义页面,但是当我查看网站时,有些内容会加载,有些内容不会在网站上加载截图。
<?php
/**
* Template Name: Front-Page
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('templates/header'); ?>
<?php get_template_part('templates/page-about'); ?>
<?php get_template_part('templates/page-services'); ?>
<?php get_template_part('templates/page-photography'); ?>
<?php get_template_part('templates/page-portfolio'); ?>
<?php get_template_part('templates/page-contact'); ?>
<?php get_template_part('templates/footer'); ?>
<?php endwhile; ?>
</main><!-- #main -->
</div><!-- #primary -->
【问题讨论】:
标签: php wordpress custom-wordpress-pages