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>
登录后复制

以上就是Wordpress如何产品展示页的详细内容,更多请关注慧达AI工具网其它相关文章!

转载请说明出处 内容投诉内容投诉
慧达seo-站长工具-seo工具-采集-发布-AI文章生成发布工具 » wordpress如何做产品展示页

慧达AI专注站群seo管理工具

查看演示 官网购买