[解決済み] お勧めの商品

フォーラム テンプレート(テーマ) [解決済み] お勧めの商品

  • このトピックには2件の返信、2人の参加者があり、最後にkonpeitouにより11年、 2ヶ月前に更新されました。
3件の投稿を表示中 - 1 - 3件目 (全3件中)
  • 投稿者
    投稿
  • #52209
    konpeitou
    参加者

    動作に関するご質問の場合は必ずご記入ください。


    WordPress のバージョン:WordPress 3.5

    Welcart のバージョン:Version 1.2.3.1301213

    ご利用のテーマ:biz7_net_brown

    症状を確認したブラウザ:

    サーバー(会社名、サービス名):さくらレンタルサーバー

    SSLの利用: 無し | 専用SSL | 共用SSL

    WordPress のパーマリンク設定:


    biz7_net_brownというテーマを使っていて、

    上記のサイトのhome.phpの新着商品をサイドバーのウィジェットのように

    おすすめカテゴリの商品が、ランダムに表示されるように変更したいのですが、

    welcart default Themeのhome.phpの

    <?php /* Section of Recommended Products *******************************/ ?>

    <div class=”title”><?php _e(‘Items recommended’,’usces’) ?></div>

    <div class=”clearfix”>

    <?php query_posts( array(‘category_name’=>’itemreco’, ‘posts_per_page’=>8) ); ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); usces_the_item(); ?>

    <div class=”thumbnail_box”>

    <div class=”thumimg”>“><?php usces_the_itemImage(0, 108, 108); ?></div>

    <div class=”thumtitle”>” rel=”bookmark”><?php usces_the_itemName(); ?> (<?php usces_the_itemCode(); ?>)</div>

    <div class=”price”><?php usces_crform( usces_the_firstPrice(‘return’), true, false ); ?><?php usces_guid_tax(); ?></div>

    </div>

    <?php endwhile; ?>

    <?php else: ?>

    <p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>

    <?php endif; wp_reset_query(); ?>

    </div>

    <?php /******************************************************************/ ?>

    を単純に張り付ければいいかと思いましたが、ランダム表示をしてくれませんでした。

    どこを変更すればよいのでしょうか?

    ご教授お願いいたします。

    #66051
    komokomo
    参加者

    もう少し勉強するか検索してみましょう。

    沢山情報がヒットしますよ。

    query_postsで商品を取得するのでしたらrandが使用できます。

    query_posts(array('category_name'=>'itemreco', 'posts_per_page'=>8,'orderby'=>'rand'));

    これでランダムに取得できませんか?

    #66052
    konpeitou
    参加者

    親切に教えていただき、ありがとうございました。

    また、何かございましたらお願いいたしますm(_ _)m

3件の投稿を表示中 - 1 - 3件目 (全3件中)
  • このトピックに返信するにはログインが必要です。