【发布时间】:2015-08-20 22:39:30
【问题描述】:
我有“俱乐部”的自定义帖子类型和“俱乐部活动”的自定义帖子类型。如何在我的单个活动页面(而不是 while 循环)上获取俱乐部的名称?
我找了又找,但我只能找到一个循环。
以下是单个事件页面的代码。
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<section class="entry-content">
<ul>
<li>Club Name: { get Club Name from Club post type relationship } </li>
<li>Other detail: <?php the_field('blah_blah'); ?>
<li>.....other details.....</li>
</ul>
<?php the_content(); ?>
</section>
<?php endwhile; endif; ?>
【问题讨论】:
-
您的活动如何通过自定义字段与您的俱乐部相关联?
-
通过高级自定义字段关系链接。所以当我去添加一个事件(帖子类型)时,我可以从俱乐部(帖子类型)中选择一个名称。
标签: php wordpress advanced-custom-fields