目次
投稿オブジェクトのフィールドを出力
<?php
$featured_posts = get_field('投稿オブジェクト名');
if( $featured_posts ): ?>
<ul>
<?php foreach( $featured_posts as $featured_post ):
$permalink = get_permalink( $featured_post->ID );
$title = get_the_title( $featured_post->ID );
$custom_field = get_field( 'フィールド名', $featured_post->ID );
?>
<li><a href="<?php echo esc_url( $permalink ); ?>"><?php echo esc_html( $title ); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
コメント