LOGO

Web development services fast secure and SEO optimized by VertixWeb

Email:mr.wangweb@gmail.com

Get a Proposal
Get a Proposal
Contact Us

woocommerce模板制作简易教程


woocommerce是wordpress里比较好用的电商解决方案,但是制作woocommerce模板相对比较复杂,如果想用woocommerce来建一个展示型的网站,不带下单功能,我们可以很快就能把模板设计出来,下面就跟着ytkah一起来学习吧

展示型网站主要用到的woocommerce函数就产品列表页和产品详情页,其余按默认模板

1、后台安装启用woocommerce插件,复制/wp-content/plugins/woocommerce/templates/下所有文件到/wp-content/themes/ytkah/woocommerce/(如果没有woocommerce文件夹,新建一个)

2、在/wp-content/themes/ytkah/function.php中添加add_theme_support函数,代码如下

add_theme_support( 'woocommerce' );

3、产品详情页模板路径是/wp-content/themes/ytkah/woocommerce/content-single-product.php,产品多图调用请参考这篇文章:woocommerce调用产品相册gallery图片如何操作?

4、产品列表页模板路径是/wp-content/themes/ytkah/woocommerce/archive-product.php,可能会用到的代码

  1.         <?php if(have_posts()) : ?>
  2. <?php while(have_posts()) : the_post(); ?>
  3. <div class=”item colxs-6 colsm-4 colmd-3″>
  4. <a href=”<?php the_permalink(); ?>”>
  5. <img src=”<?php the_post_thumbnail_url( ‘small‘ ); ?>” alt=”<?php the_title(); ?>”>
  6. <p><?php the_title(); ?></p>
  7. </a>
  8. </div>
  9. <?php endwhile; ?>
  10. <?php else : ?>
  11. This is no product here!
  12. <?php endif; ?>

5、有些功能需要引用woocommerce插件自带的css和js文件

6、文件加载顺序

①/wp-content/themes/hqt/woocommerce/global/wrapper-start.php里面的外层div/main

②面包屑导航/wp-content/themes/hqt/woocommerce/global/breadcrumb.php

③产品信息/wp-content/themes/hqt/woocommerce/content-single-product.php
包含
图片展示
@hooked woocommerce_show_product_sale_flash是否促销标志
@hooked woocommerce_show_product_images
产品简要信息
@hooked woocommerce_template_single_title – 5
@hooked woocommerce_template_single_rating – 10
@hooked woocommerce_template_single_price – 10
@hooked woocommerce_template_single_excerpt – 20
@hooked woocommerce_template_single_add_to_cart – 30
@hooked woocommerce_template_single_meta – 40
@hooked woocommerce_template_single_sharing – 50
@hooked WC_Structured_Data::generate_product_data() – 60
产品详细信息
@hooked woocommerce_output_product_data_tabs – 10
@hooked woocommerce_upsell_display – 15
@hooked woocommerce_output_related_products – 20

等等

如果不知道页面用到哪些模板文件,可以用第三方插件来实时查看,比如WooCommerce Template Hints

好了,就介绍这么多,ytkah祝您早日入手woocommerce模板制作

Author:vertixweb    View: 393 Secondary    Update:2025-06-06

Home>WooCommerce>woocommerce模板制作简易教程
E-commerce Independent Website Setup Solution

2025-06-06Cross-Border Independent Website Custom Development Solution WordPress International Legal Services Website Development Service Plan

2025-06-06Cross-border E-commerce WordPress + WooCommerce Customized Setup Solution for Optical Measurement Instrument Standalone Stores

2025-06-06Customized Website Development Service Solution for Cross-border E-commerce Independent Sites of Optical Measuring Instruments

2025-06-06Cross-border eCommerce WordPress + WooCommerce Customized Solution for Building an Industrial Automation Instruments Independent Website

2025-06-06Cross-border E-commerce WordPress + WooCommerce Convenience Store Independent Website Customization and Setup Solution

2025-06-06Cross-border e-commerce WordPress + WooCommerce men’s clothing factory independent station custom website development service solution

2025-06-06Cross-Border E-Commerce Independent Website Development Proposal Technical Solution for WordPress-Based Independent Site

2025-06-06Cross-border e-commerce tile product WordPress + WooCommerce independent site construction website customization and development solution

2025-06-06Cross-border e-commerce WordPress + WooCommerce food additives independent station customized website development service solution

Marketing Optimization (MO) Solutions

2025-06-06Cross-Border E-Commerce Independent Site GEO (Precision Localized SEO) Market Expansion

2025-06-06E-Commerce Geo-Targeting SEO Optimization Plan for Europe and the US

2025-06-06Geographical Marketing Optimization (GMO)

2025-06-06Brand Marketing Optimization (BMO)

2025-06-06North American E-Commerce Geo-Targeting SEO Optimization Plan

2025-06-06Marketing Optimization (MO) Solution Services

2025-06-06Custom website development with DeepSeek for independent sites

2025-06-06Marketing Optimization (MARQ) Solution

2025-06-06DeepSeek Custom-Tuned Precision Translation & Multilingual Website Development Services

Custom Theme Advantages vs. Template Theme
  • Comparison Dimension Custom Theme Generic Template Theme
  • Uniqueness 100% original design, avoiding homogenization Potentially used by hundreds of websites
  • Performance Optimization On-demand coding, no redundant code Contains a large amount of useless functional code
  • Functional Fit Perfectly matches business requirements Requires compromise or complex modifications
  • SEO Foundation SEO optimized at architectural level Generic SEO structure with limited effectiveness
  • Maintenance Cost Clean code, easy to maintain Complex nesting, difficult to maintain
  • Scalability Predefined interfaces for easy expansion Expansion limited by template constraints
  • Loading Speed Streamlined code for faster speed Redundant features slow down performance
  • Brand Image Enhances brand recognition Difficult to establish unique identity

Free application for your personalized plan


Contact Us
Website Construction
Performance Marketing Enhancement Suite(MO)

message x - -
Contact Us

Apply for your exclusive plan for free

Later Consultation

Online Consulting