WordPress Web サイトで Advanced Custom Fields プラグインを使用しています。子ページのリピーター フィールド ('photos_presse') の最初の画像 ('photo') をページに表示しています。これが私が使用しているphpコードです。
<?php
$args = array(
'post_type' => 'page',
'post_parent' => $post->ID,
'order' => 'ASC',
'orderby' => 'menu_order',
'post_status' => 'publish',
'number' => 'no limit',
);
$parent = new WP_Query( $args );
if ( $parent->have_posts() ) : ?>
<?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<div id="parent-<?php the_ID(); ?>" class="parent-page">
<div class="cartouche_crop">
<?php
$first_img = true;
while($first_img && has_sub_field('photos_presse')): ?>
<img src="<?php the_sub_field('photo'); ?>" class="artists_menu">
<?php $first_img = false; ?>
<?php endwhile; ?>
</div>
<h1><?php the_title(); ?></h1>
</div>
</a>
<?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
これは、最初の画像を取得するためのコードの一部です:
<?php
$first_img = true;
while($first_img && has_sub_field('photos_presse')): ?>
<img src="<?php the_sub_field('photo'); ?>" class="artists_menu">
<?php $first_img = false; ?>
<?php endwhile; ?>
リピーター フィールドに画像を読み込むと、サムネイル画像が作成されます。これは、WordPress 管理画面の「メディア設定」メニューで設定できます。(小中大)。
画像ごとに、小、中、大、および元のサイズの 4 つのファイルが作成されます。
私がやりたいのは、各リピーターフィールドの最初の元の画像を取得する代わりに、リピーターフィールドの最初の中サイズのサムネイルを取得したいということです。
これを行う方法が見つかりません...
誰でもこれで私を助けることができますか?
ご協力いただきありがとうございます