カスタム投稿タイプを作成
カスタム投稿で、親子関係を設定します。
繰り返したいカスタムフィールドのグループを設定、
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php $child_posts = types_child_posts( "フィールド名" ); foreach ($child_posts as $child_post) { ?> <div class="room-listing"> <h5><?php echo $child_post->post_title; ?></h5> <p class="room-image"><?php echo types_render_field( "フィールド名", array( "id"=> "$child_post->ID", "size" => "thumbnail" )); ?></p> <p class="room-size"><?php echo types_render_field( "フィールド名", array( "id"=> "$child_post->ID")); ?>m²</p> </div><!-- .room-listing --> <?php } ?> |
上記のコードで繰り返したいカスタムフィールドを表示できます。
コメント