アプリ版:「スタンプのみでお礼する」機能のリリースについて

ランキングを表示する際の画像の大きさを固定することは可能でしょうか?

<?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'post-thumbnail', array(100, 100)); } ?>
のようにしてみたのですが、大きさの指定が無視されてしまいます。
( has_post_thumbnail(100, 100) のようにすると、画像が消えてしまい大きさの指定ができませんでした。


<!-- ▼ 週間ランキング ▼ -->
<div class="main-wrap" style="width: 300px;">
<section class="column-inner">
<?php
$args = array(
'numberposts' => 10, //表示数
'meta_key' => 'pv_count_month',
'meta_key' => 'single_rss_feed1',
'orderby' => 'meta_value_num',
'order' => 'DESC',);

$posts = get_posts($args);
if ($posts) : ?>
<ul class="parent_box">
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<li class="child_box">
<a href="<?php echo get_permalink(); ?>" width: 97px;height: 130px;>
<div class="mosaic-backdrop">
<?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'post-thumbnail', array(100, 100)); } ?> </div>
<div class="masking"> <span class="masktext"><?php the_title(); ?><span id="likeCount3"></span></span>
</div>
</a>
<div class="info topinfo">
<p>
<?php $count = sprintf("%02d",$count); // 一桁を二桁に echo $count + 1; // 01を出力 $count++; ?> </p>
</div>
<?php echo getPostViewsMonth(get_the_ID()); // 記事閲覧回数表示 */?>
<?php endforeach; wp_reset_postdata(); ?> </li>
</ul>
<?php else : ?>
<p>アクセスランキングはまだ集計されていません。</p>
<?php endif; ?> </section>
</div>

A 回答 (1件)

よくわかっていないのですが、<?php the_post_thumbnail(array(100, 100)); ?>


ではダメなのでしょうか?
ダメなら、CSSに
.mosaic-backdrop img {
width: 100px;
height: 100px;
}
を入力するか

アイキャッチ画像のサイズをwordpress側で指定してしまうかですかね。
https://www.javadrive.jp/wordpress-theme/nishiki …
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!