フォーラムへの返信

4件の返信を表示中 - 1 - 4件目 (全4件中)
  • フォーラム: 使い方全般
    返信が含まれるトピック: post_thumbnailについて

    rosesさん、こんにちは。
    post_thumbnailからは外れてしまいますが、similar postsでサムネイル表示させればよいのなら、設定の「Output」-「Output template:」の表示させたい部分に

    <a href="{url}"><img src="{custom:thumbnail}" alt="{title}" width="***" height="***" /></a>

    を入れて、記事のthumbnailというカスタムフィールドに表示させたいサムネイルのURLを入れればサムネイルを表示させられます。

    shoku0803さんの言うとおり、単にcssの指定が間違ってるだけですね。
    text => #s{}
    submit => #searchsubmit{}
    です。

    <?php
    $posts = get_posts('numberposts=5&category=カテゴリID');
    if($posts): foreach($posts as $post): setup_postdata($post); $counter++;
    if ($counter <= 1) {
    ?>
    <h2><a href="<?php the_permalink() ?>" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h2>
    <div>
    <a href="<?php the_permalink() ?>">
    <?php
    $files = get_children("post_parent=$id&post_type=attachment&post_mime_type=image");
    if (!empty($files)){
    print get_the_post_image($post->ID, 取得したい画像のサイズ「thumbnail, medium, large, fullの中から選択」);
    } else { ?>
    <img src="投稿に画像が無い場合に表示する画像のURL" width="***" height="***" alt="text only" />
    <?php } ?>
    </a>
    </div>
    <?php $content_text =  strip_tags($post->post_content); ?>
    <p><?php echo mb_strimwidth($content_text,0,300,'…'); ?></p>
    <p><a href="<?php the_permalink(); ?>">もっと読む</a></p>
    <?php } else { ?>
    <div>
    <a href="<?php the_permalink() ?>">
    <?php
    $files = get_children("post_parent=$id&post_type=attachment&post_mime_type=image");
    if (!empty($files)){
    print get_the_post_image($post->ID, 取得したい画像のサイズ「thumbnail, medium, large, fullの中から選択」);
    } else { ?>
    <img src="投稿に画像が無い場合に表示する画像のURL" width="***" height="***" alt="text only" />
    <?php } ?>
    </a>
    </div>
    <p><?php the_time('M j, Y H:i ') ?></p>
    <h3><a href="<?php the_permalink() ?>" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h3>
    <?php
    }
    ?>
    <?php endforeach; endif; ?>

    カテゴリIDと画像あたりを変更して下さい。で、あとはHTMLタグを適当に変えて、CSSで見た目を整えて下さい。

    フォーラム: 使い方全般
    返信が含まれるトピック: get_permalink
    gigacode

    (@gigacode)

    それで合ってますので、該当ページのIDを指定してみて下さい。

4件の返信を表示中 - 1 - 4件目 (全4件中)