10 KiB
Nenghui Energy Theme - 短代码使用文档
本文档提供了 Nenghui Energy 主题中所有可用短代码的详细说明和使用示例。
目录
产品相关短代码
nenghui_products_list - 产品列表
显示产品列表,支持分类筛选和分页。
基本用法:
[nenghui_products_list]
完整参数:
[nenghui_products_list
per_page="6"
category="residential"
order="date"
orderby="DESC"
category_order=""]
参数说明:
per_page- 每页显示的产品数量(默认:6)category- 筛选特定分类(留空显示所有)order- 排序方式(默认:date)orderby- 排序字段(默认:DESC)category_order- 自定义分类排序
产品自定义字段:
cate_type- 产品分类(必需)cate_type_value- 分类显示名称efficiency- 效率值(如:≥93% Efficiency)is_new- 是否为新产品(true/false)attr_key- 属性名称(逗号分隔)attr_value- 属性值(逗号分隔)_product_banner_url- 产品横幅图片URL_usage_scenario_data- 使用场景数据(包含bottom_text)
示例:
// 显示所有产品,每页9个
[nenghui_products_list per_page="9"]
// 只显示residential分类的产品
[nenghui_products_list category="residential"]
// 自定义排序
[nenghui_products_list order="title" orderby="ASC"]
nenghui_products_banner - 产品横幅
显示产品页面横幅。
基本用法:
[nenghui_products_banner]
或简化版本:
[products_banner]
nenghui_warehousing_distribution - 仓储配送
显示仓储配送信息。
基本用法:
[nenghui_warehousing_distribution]
或简化版本:
[warehousing_distribution]
新闻相关短代码
nenghui_news - 新闻列表
显示新闻文章列表。
基本用法:
[nenghui_news]
完整参数:
[nenghui_news
title="最新资讯"
category_id="1"
posts_count="6"
order_by="date"
order="DESC"]
参数说明:
title- 模块标题category_id- 分类IDposts_count- 显示文章数量order_by- 排序字段order- 排序方向
nenghui_news_grid - 新闻网格
以网格布局显示新闻。
基本用法:
[nenghui_news_grid]
关于页面短代码
nenghui_about_nav - 关于导航
显示关于页面的导航菜单。
基本用法:
[nenghui_about_nav]
自定义参数:
[nenghui_about_nav menu_id="123"]
参数说明:
menu_id- 指定菜单ID(留空使用自定义器设置的默认菜单)
nenghui_about_company - 关于公司
显示公司介绍信息。
基本用法:
[nenghui_about_company]
自定义参数:
[nenghui_about_company show_animation="true"]
参数说明:
show_animation- 是否显示动画效果
nenghui_development_history - 发展历程
显示公司发展历程时间线。
基本用法:
[nenghui_development_history]
自定义参数:
[nenghui_development_history show_animation="true"]
nenghui_certification_gallery - 认证画廊
显示公司认证证书画廊。
基本用法:
[nenghui_certification_gallery]
自定义参数:
[nenghui_certification_gallery
columns="5"
lightbox="true"
animation="true"]
参数说明:
columns- 每行显示列数(1-6)lightbox- 是否启用灯箱效果animation- 是否启用动画效果
nenghui_technical_service - 技术服务
显示技术服务信息。
基本用法:
[nenghui_technical_service]
自定义参数:
[nenghui_technical_service
title="可靠的技术服务"
subtitle="提升客户体验"]
black_about_company_banner - 关于公司横幅
显示关于页面的横幅。
基本用法:
[black_about_company_banner]
nenghui_black_about_info - 关于信息
显示公司详细信息。
基本用法:
[nenghui_black_about_info]
或简化版本:
[black_about_info]
business_process - 业务流程
显示业务流程图。
基本用法:
[business_process]
联系页面短代码
nenghui_contact_form - 联系表单
显示联系表单。
基本用法:
[nenghui_contact_form]
自定义参数:
[nenghui_contact_form form_id="1" show_animation="true"]
参数说明:
form_id- 表单IDshow_animation- 是否显示动画效果
nenghui_contact_map - 联系地图
显示联系地图。
基本用法:
[nenghui_contact_map]
nenghui_overseas_services - 海外服务
显示海外服务信息。
基本用法:
[nenghui_overseas_services]
通用组件短代码
nenghui_banner - 轮播横幅
显示轮播横幅。
基本用法:
[nenghui_banner]
自定义参数:
[nenghui_banner autoplay="true"]
参数说明:
autoplay- 是否自动播放
nenghui_futures - 未来展望
显示未来展望内容。
基本用法:
[nenghui_futures]
自定义参数:
[nenghui_futures title="未来展望" show_animation="true"]
nenghui_tabs - 选项卡
显示选项卡内容。
基本用法:
[nenghui_tabs]
自定义参数:
[nenghui_tabs tabs_count="3" show_animation="true"]
nenghui_flowchart_tabs - 流程图选项卡
显示流程图选项卡。
基本用法:
[nenghui_flowchart_tabs]
nenghui_banner_title - 标题横幅
显示带标题的横幅。
基本用法:
[nenghui_banner_title title="关于我们" description="我们致力于提供最优质的服务"]
完整参数:
[nenghui_banner_title
title="关于我们"
description="我们致力于提供最优质的服务"
bg_image="https://example.com/image.jpg"
height="70vh"
overlay_opacity="0.6"
show_animation="true"]
参数说明:
title- 标题description- 描述bg_image- 背景图片URLheight- 高度(支持px、vh、%)overlay_opacity- 遮罩透明度(0-1)show_animation- 是否显示动画
black_maps - 黑色地图
显示交互式地图。
基本用法:
[black_maps]
自定义参数:
[black_maps height="100vh" show_loading="true"]
参数说明:
height- 地图高度show_loading- 是否显示加载动画
nenghui_video - 视频
显示视频播放器。
基本用法:
[nenghui_video video_url="https://example.com/video.mp4"]
完整参数:
[nenghui_video
video_url="https://example.com/video.mp4"
cover_image="https://example.com/cover.jpg"
title="我们的企业视频"
description="了解我们的产品和服务"
play_button_text="立即播放"
show_overlay="true"
overlay_opacity="0.5"
height="80vh"
autoplay="false"
muted="true"
controls="true"]
参数说明:
video_url- 视频URL(必需)cover_image- 封面图片URLtitle- 视频标题description- 视频描述play_button_text- 播放按钮文字show_overlay- 是否显示遮罩overlay_opacity- 遮罩透明度height- 视频高度autoplay- 是否自动播放muted- 是否静音controls- 是否显示控制栏
nenghui_download_center - 下载中心
显示下载中心。
基本用法:
[nenghui_download_center]
nenghui_faq - 常见问题
显示常见问题列表。
基本用法:
[nenghui_faq]
nenghui_cases - 案例展示
显示案例展示。
基本用法:
[nenghui_cases]
EPC相关短代码
nenghui_epc - EPC解决方案
显示EPC解决方案。
基本用法:
[nenghui_epc]
自定义参数:
[nenghui_epc
title="EPC Solutions"
subtitle="Beyond Hardware: Total EPC Solutions from NengHui Design Institute"
bg_image="https://example.com/epc-bg.jpg"]
nenghui_epc_banner - EPC横幅
显示EPC横幅。
基本用法:
[nenghui_epc_banner]
使用技巧
1. 在页面编辑器中使用
在WordPress页面编辑器中,直接输入短代码即可:
[nenghui_products_list per_page="9"]
2. 在模板文件中使用
在主题模板文件中使用 do_shortcode() 函数:
<?php echo do_shortcode('[nenghui_products_list per_page="9"]'); ?>
3. 组合使用多个短代码
可以在同一个页面中使用多个短代码:
[nenghui_banner_title title="我们的产品"]
[nenghui_products_list per_page="9"]
[nenghui_contact_form]
4. 响应式设计
所有短代码都支持响应式设计,会自动适应不同屏幕尺寸。
5. 深色模式
所有短代码都支持深色模式,会自动根据系统设置切换主题。
常见问题
Q: 短代码不显示怎么办?
A: 请确保:
- 短代码名称拼写正确
- 主题已正确激活
- 没有PHP错误(检查调试日志)
Q: 如何自定义短代码样式?
A: 可以通过以下方式自定义:
- 在自定义器中修改相关设置
- 使用CSS覆盖默认样式
- 修改对应的模板文件
Q: 短代码参数不生效怎么办?
A: 请确保:
- 参数名称拼写正确
- 参数值格式正确
- 没有特殊字符冲突
Q: 如何添加新的短代码?
A: 可以在 inc/shortcode.php 文件中添加新的短代码函数,参考现有短代码的实现方式。
技术支持
如需技术支持,请联系开发团队或查看主题文档。
文档版本: 1.0
最后更新: 2026-02-09
主题版本: nenghui-energy-theme-4