您现在的位置是:首页 > 教程 > WordPress教程WordPress教程
wordpress怎么做产品展示页
盼曼2023-07-30 23:37:48WordPress教程已有人查阅
导读wordpress做产品展示页实现步骤如下:后台创建文章分类:产品中心,在主题的functions.php中,添加一段代码,代码如下:三、添加文章并设置缩略图
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支持中文URL的方法
之前在配置WordPress的时候做了个固定链接(%postname%),但在这之后我在我无意间点到文章的中文TAG的链接wordpress主题怎么安装
进入网站后台(一般是:域名/wp-admin),点击左侧菜单中的外观,然后点击主题,右侧会有“添加”按钮,点击“上传主题”并选择你要安装的主题压缩包wordpress发长文章的方法
有时单个文章页面篇幅过长,会影响页面加载速度和用户体验,这时我们需要使用WordPress长文章分页显示。实现分页有二种方法wordpress主题使用方法
wordpress主题模板的使用,是在仪表盘-外观-主题中,在网上下载的模板,可以直接将主题文件夹拖至xampp/hcdogcs/wordpress/content/themes的文件夹下
留言与评论 (共有 条评论) |