wordpress怎么做產品展示頁

wordpress怎么做產品展示頁

wordpress做產品展示頁實現步驟如下

一、創建分類

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

wordpress怎么做產品展示頁

二、開啟縮略圖功能

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

add_theme_support(?'post-thumbnails'?);

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

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

<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>

更多WordPress相關技術文章,請訪問wordpress教程欄目進行學習!

以上就是

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