wordpress如何做產品展示頁

wordpress如何做產品展示頁

產品展示用到文章和縮略圖功能

wordpress如何做產品展示頁

相關推薦:《WordPress教程

實現步驟:

一、創建分類

后臺創建文章分類:產品中心

wordpress如何做產品展示頁

二、開啟縮略圖功能

在主題的functions.php中,添加一段代碼,代碼如下:

add_theme_support(?'post-thumbnails'?);

更多設置請參考:

http://www.cnblogs.com/tinyphp/p/6359167.html

三、添加文章并設置縮略圖

四:調用該分類信息、文章標題和縮略圖?

<div> <?php     $product_term =get_term_by(&#39;name&#39;,&#39;產品中心&#39;,category);     $product_term_id=$product_term->term_id; ????$product_link=get_term_link($product_term_id,'category'); ?&gt; ????<h2> ??????????<a>"&gt;產品中心</a> ????????<span><a>"&gt;</a></span> ????</h2> ????<ul> ????<?php         $product_query=new WP_Query(array(             &#39;cat&#39;=>2, ????????????'posts_per_page'=&gt;8 ????????????)); ????if($product_query-&gt;have_posts())?:?while($product_query-&gt;have_posts())?:$product_query-&gt;the_post(); ?????&gt; ????<li> ???????<a>"&gt;? ???????????<?php  if ( has_post_thumbnail() ) : ?> ????????????<?php  the_post_thumbnail( &#39;thumbnail&#39; ); ?> ????????????<?php  else: ?> ????????????//顯示默認圖片 ????????????<?php  endif; ?> ????????</a> ????????<h3><a>"&gt;<?php  the_title();?>dd</a></h3> ????</li>??????????? ????<?php  endwhile;?> ????<?php  endif;?> ????</ul>??? </div>

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊8 分享