【发布时间】:2022-06-28 05:17:09
【问题描述】:
<?php $wheretowatch = get_field('wheretowatch'); ?>
<?php foreach($wheretowatch as $wheretowatch):?>
<div class="movies-series-tvshow-wheretowatch">
<div class="movies-series-tvshow-wheretowatch-thumbnail">
<a href="<?php echo get_page_link($wheretowatch->ID);?>"> <img src="<?php echo get_the_post_thumbnail_url($wheretowatch->ID, 'thumbnail');?>"></a>
</div>
<div class="movies-series-tvshow-wheretowatch-title">
<a href="<?php echo get_page_link($wheretowatch->ID);?>"><h6><?php echo $wheretowatch->post_title;?></h6></a>
</div>
</div>
<?php endforeach;?>
没有在关系字段中输入值时出现错误是否有错误当条件不满足时如何给出回显?
【问题讨论】:
-
如果这是一个关系字段 - 我会遵循关系字段的文档,并使用 if have_rows,while have_rows 等。
标签: wordpress advanced-custom-fields