archive.phpでwp_get_attachment_imageで出力した画像を画像の縦横比毎にclassの自動追加で制御したい
<?php if(have_posts() ): //投稿があった場合 ?> <?php while ( have_posts() ) : the_post(); //ループ開始 ?> <?php $post_id = get_the_ID(); ?> <?php $attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image', )); foreach( $attachments as $attachment_id => $attachment ) : ?> <div class="item blue w" data-color="blue"> <div class="item-content"> <?php echo wp_get_attachment_image( $attachment_id , 'large' );?> <a href="../content/index.html"> <div class="mask"> <div class="caption"><?php the_title(); ?></div> </div></a> </div> </div> <?php endforeach; ?> <?php endwhile; ?> <?php endif; ?>現状この状態なのですが、ep_get_attachmet_imageで出力されるimg
タグにクラスを付与、また<div class="item blue w" data-color="blue">の部分のクラス、データカラーの部分の値をwordpressの管理画面側から出力して,
出力されたclassにcssを当て縦横比毎に変わるように制御できないかと考えております。
稚拙な文章での質問、大変申し訳ないのですが、方法を知っている方が居ましたら是非ご教授願いたいです。
よろしくお願いします。