当前位置:首页站长学院WordPresswordpress怎么做产品展示页
企业营销,就选知企PROSAAS

wordpress怎么做产品展示页

wordpress怎么做产品展示页

wordpress做产品展示页实现步骤如下

一、创建分类

后台创建文章分类:产品中心

wordpress怎么做产品展示页

二、开启缩略图功能

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

add_theme_support( 'post-thumbnails' );

三、添加文章并设置缩略图

四、调用该分类信息、文章标题和缩略图

<div class="section sectionL">

<?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 href="<?php echo $product_link?>">产品中心</a>
        <span><a href="<?php echo $product_link;?>"></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 href="<?php the_permalink();?>"> 
           <?php if ( has_post_thumbnail() ) : ?>
            <?php the_post_thumbnail( 'thumbnail' ); ?>
            <?php else: ?>
            //显示默认图片
            <?php endif; ?>
        </a>
        <h3><a href="<?php the_permalink();?>"><?php the_title();?>dd</a></h3>
    </li>           
    <?php endwhile;?>
    <?php endif;?>
    </ul>   
</div>

更多wordpress相关技术文章,请访问wordpress教程栏目进行学习!

以上就是wordpress怎么做产品展示页的详细内容,更多请关注知企PROSAAS其它相关文章!

温馨提示:

文章标题:wordpress怎么做产品展示页

文章链接:https://ceshi.prosaas.cn/8355.html

更新时间:2019年07月19日

声明: 本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:973664285@qq.com我们将第一时间处理! 资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。 所有资源仅限于参考和学习,版权归原作者所有,更多请阅读知企PROSAAS协议

给TA打赏
共{{data.count}}人
人已打赏
WordPress

为什么wordpress会出现404错误

2019-7-19 16:15:25

WordPress

wordpress如何更改主页为home

2019-7-19 16:37:55

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索