bootscore / bs-swiper
BootScore 中的 Swiper 滑块
v5.8.6
2024-09-13 09:00 UTC
README
WordPress 插件,用于在 BootScore 主题中通过 swiper.js 滑块展示文章、页面、自定义文章类型或 WooCommerce 产品。
安装
- 下载最新版本 bs-swiper.zip。
- 在您的管理面板中,转到插件 > 然后点击添加新插件按钮。
- 点击上传插件并选择文件,然后选择插件的 .zip 文件。点击立即安装。
- 点击激活即可立即使用新插件。
使用方法
通过替换短代码示例中的 bs-swiper-*
占位符来选择您想使用的模板。
bs-swiper-card
以 4 (xxl)、3 (lg)、2 (md) 和 1 (sm) 列卡片的形式显示项目。bs-swiper-card-autoplay
以 4 (xxl)、3 (lg)、2 (md) 和 1 (sm) 列卡片的形式显示项目,并具有自动播放功能。bs-swiper-hero
以带有自动滑动效果的英雄滑块显示项目。项目必须具有特色图片。bs-swiper-hero-fade
以带有自动淡入淡出效果的英雄滑块显示项目。项目必须具有特色图片。bs-swiper-card-product
仅以 4 (xxl)、3 (lg)、2 (md) 和 1 (sm) 列卡片的形式显示 WooCommerce 产品。
文章
通过分类显示文章的短代码
[bs-swiper-* type="post" category="cars, boats" order="ASC" orderby="date" posts="6"]
选项
category=""
- 分类-slug,多个分类用逗号分隔order=""
- ASC 或 DESCorderby=""
- 日期、标题或 randposts=""
- 显示文章的数量excerpt="false"
- 隐藏摘要tags="false"
- 隐藏标签categories="false"
- 隐藏分类
通过标签显示文章的短代码
[bs-swiper-* type="post" tax="post_tag" terms="bikes, motorbikes" order="DESC" orderby="date" posts="5"]
选项
tax=""
- 分类法(post_tag)terms=""
- 标签-slug,多个标签用逗号分隔order=""
- ASC 或 DESCorderby=""
- 日期、标题或 randposts=""
- 显示文章的数量excerpt="false"
- 隐藏摘要tags="false"
- 隐藏标签categories="false"
- 隐藏分类
通过 id 显示单个文章的短代码
[bs-swiper-* type="post" id="1, 15"]
选项
id=""
- 文章 id,多个 id 用逗号分隔excerpt="false"
- 隐藏摘要tags="false"
- 隐藏标签categories="false"
- 隐藏分类
页面
通过父页面 id 显示子页面的短代码
[bs-swiper-* type="page" post_parent="21" order="ASC" orderby="title" posts="6"]
在父页面中显示子页面非常有用,可以避免空父页面。
选项
post_parent=""
- 父页面 idorder=""
- ASC 或 DESCorderby=""
- 日期、标题或 randposts=""
- 显示页面的数量excerpt="false"
- 隐藏摘要
通过 id 显示单个页面的短代码
[bs-* type="page" id="2, 25"]
选项
id=""
- 页面 id,多个 id 用逗号分隔excerpt="false"
- 隐藏摘要
自定义文章类型
通过术语显示自定义文章类型的短代码
[bs-swiper-* type="isotope" tax="isotope_category" terms="dogs, cats" order="DESC" orderby="date" posts="5"]
选项
type=""
- 自定义文章类型类型tax=""
- 分类法terms=""
- 术语-slug,多个术语用逗号分隔order=""
- ASC 或 DESCorderby=""
- 日期、标题或 randposts=""
- 显示自定义文章类型的数量excerpt="false"
- 隐藏摘要
通过 id 显示单个自定义文章类型的短代码
[bs-* type="isotope" id="33, 31"]
选项
id=""
- 自定义文章类型 id,多个 id 用逗号分隔excerpt="false"
- 隐藏摘要
WooCommerce 产品
显示产品的短代码
[bs-swiper-card-product]
选项
category="cars, boats"
- 分类 slug,多个分类用逗号分隔。将拉取匹配这些分类的产品(默认:''
)id="1, 2, 3"
- 产品(s)的 id,多个 id 用逗号分隔。将显示匹配这些 id 的产品(默认:''
)brand="brand1, brand2"
- 将拉取匹配这些品牌的产品(默认:''
)posts="12"
- 指定将显示多少产品(默认:-1
)orderby="date"
-date
、title
或rand
。指定产品按何种方式排序(默认:date
)order="DESC"
- 指定产品是按ASC
或DESC
排序(默认:DESC
)featured="true"
- 将获取特色产品(默认:false
)outofstock="false"
- 将隐藏库存为零的产品(默认:true
)onsale="true"
- 仅显示促销产品(默认:''
)showhidden="true"
显示从目录中隐藏的产品(默认:false
)
相关帖子
Bootscore v5.3.1 为所有 single-*.php
添加了钩子
<?php if (function_exists('bootscore_related_posts')) bootscore_related_posts(); ?>
bs Swiper 在此处显示相关帖子钩子,显示来自同一分类的最新 12 篇帖子。这意味着该分类至少应有 4 篇帖子才能正确显示相关帖子。
可以通过在子模块的 functions.php
中添加过滤器来删除相关帖子
// Remove related posts add_filter('bootscore_disable_related_posts', '__return_true');
或通过一行 CSS
.related-posts { display: none; }
通过主题覆盖模板
模板文件位于插件目录 /bs-swiper/templates/
中。
使用覆盖方式安全地编辑文件。将模板复制到主题目录中的 /bs-swiper/
目录下,保持相同的文件结构,但移除 /templates/
子目录。路径必须是 /your-theme/bs-swiper/[file].php
。
复制的文件将覆盖 bs Swiper 模板文件。根据需要更改卡片、类或 HTML。
可以覆盖的模板
related-posts.php
sc-swiper-card.php
sc-swiper-card-autoplay.php
sc-swiper-card-product.php
sc-swiper-hero.php
sc-swiper-hero-fade.php
许可 & 致谢
- bs Swiper,MIT 许可证 https://github.com/bootscore/bs-swiper/blob/main/LICENSE
- swiper.js,nolimits4web,MIT 许可证 https://github.com/nolimits4web/swiper/blob/master/LICENSE
- Plugin Update Checker,YahnisElsts,MIT 许可证 https://github.com/YahnisElsts/plugin-update-checker/blob/master/license.txt