• 解決済 iketoshi

    (@iketoshi)


    Twenty Tenを使用しています。
    トップページに特定のカテゴリのアイキャッチを表示しようとしていますが、表示は何とかされるようになったのですが、サイズが元画像のサイズで表示されてしまいます。

    functions.phpに
    add_theme_support(‘post-thumbnails’);
    set_post_thumbnail_size(160, 106, true);

    index.phpに
    <div id=”container”>
    <div id=”content” role=”main”>
    <div class=”jirei-top”>
    <?php
    query_posts(‘posts_per_page=4&category_name=04’);
    if(have_posts()):
    $count = 1;
    while(have_posts()):
    the_post();
    if($count % 2 > 0 && $count != 1):
    ?>
    </div>
    <div class=”jirei”>
    <?php
    endif;
    ?>
    <article class=”jirei-article”>
    <h1 class=”jirei-title”>“title=”<?php the_title_attribute(); ?>”><?php the_title(); ?></h1>
    <time class=”jirei-date” datetime=”<?php the_time(‘Y-m-d’); ?>”><?php the_time(get_option(‘date_format’)); ?></time>
    “><?php the_post_thumbnail(‘post-thumbnail’,array(‘alt’ => the_title_attribute(‘echo=0′),’title’ => the_title_attribute(‘echo=0’))); ?>
    <?php the_excerpt(); ?>

    <span class=”jirei-link”>“>続きを読む</span>
    </article>
    <?php
    $count++;
    endwhile;
    endif;
    wp_reset_query();
    ?>
    </div>
    </div>
    </div>

    と記述してみましたが、横160×縦106になってくれません。WPをはじめたばかりで、ネットや本を参考に半信半疑で記述しています。
    どなたかわかりますでしょうか?宜しくお願い致します。

2件の返信を表示中 - 1 - 2件目 (全2件中)
  • jim912

    (@jim912)

    iketoshiさん、こんにちは。

    Twenty Tenのもともとのアイキャッチ画像のサイズは、940*198となっています。
    functions.phpのどこに上記の記述をなされたのか不明ですが、Twenty Tenのもともとのサイズ設定が優先されて元サイズの画像が表示されている可能性が高いと思われます。

    トピック投稿者 iketoshi

    (@iketoshi)

    jim912さんお世話になります。
    以前も助けていただいたような記憶が・・・

    元の記述をそのままに最下行に追記していました。ヘッダーサイズが指定されていました。
    希望のサイズで表示できました。
    ありがとうございます。

2件の返信を表示中 - 1 - 2件目 (全2件中)
  • トピック「アイキャッチ画像が指定したサイズで表示されません。」には新たに返信することはできません。