创建主题时,使用自定义帖子类型 UI 插件。
有部分 -Customers和Projects。
在页面上page-projects.php,显示了所有内容的列表(链接)customers,如下所示:
<?php
$args = array(
'post_type' => 'customer'
);
$the_query = new WP_Query( $args );
?>
单击该链接会将您带到一个包含详细说明的单独页面。
详细描述的内容包含在章节中Projects。但是页面上single-projects.php什么也没有显示,因为 所有描述都在部分Customers。
如何显示位于另一部分的带有项目描述的帖子?
更新程序
该模板single-customer.php显示该部分的内容customers(这是合乎逻辑的)。但是需要从版块中显示帖子的内容projects。可能吗?
为此,您需要 single-customer.php 模板或标准模板(如果没有 single.php 自定义模板)
模板层次结构:
是不是这样:
需要指定
<?php the_sub_field('name-sub-field'); ?>里面
<?php while( have_rows('name-field') ): the_row(); ?>