投稿オブジェクトのフィールドを出力
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<?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; ?> |
コメント