wordpress做產品展示頁實現步驟如下:
一、創建分類
后臺創建文章分類:產品中心
二、開啟縮略圖功能
在主題的functions.php中,添加一段代碼,代碼如下:
add_theme_support(?'post-thumbnails'?);
三、添加文章并設置縮略圖
四、調用該分類信息、文章標題和縮略圖?
<div> <?php $product_term =get_term_by('name','產品中心',category); $product_term_id=$product_term->term_id; ????$product_link=get_term_link($product_term_id,'category'); ?> ????<h2> ??????????<a>">產品中心</a> ????????<span><a>"></a></span> ????</h2> ????<ul> ????<?php $product_query=new WP_Query(array( 'cat'=>2, ????????????'posts_per_page'=>8 ????????????)); ????if($product_query->have_posts())?:?while($product_query->have_posts())?:$product_query->the_post(); ?????> ????<li> ???????<a>">? ???????????<?php if ( has_post_thumbnail() ) : ?> ????????????<?php the_post_thumbnail( 'thumbnail' ); ?> ????????????<?php else: ?> ????????????//顯示默認圖片 ????????????<?php endif; ?> ????????</a> ????????<h3><a>"><?php the_title();?>dd</a></h3> ????</li>??????????? ????<?php endwhile;?> ????<?php endif;?> ????</ul>??? </div>
更多WordPress相關技術文章,請訪問wordpress教程欄目進行學習!
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END
喜歡就支持一下吧
相關推薦