benjaminmedia / wp-bcm-manager
此包最新版本(1.1.6)没有可用的许可信息。
BCM 管理器
1.1.6
2021-04-23 09:37 UTC
Requires
- php: >=5.6
This package is auto-updated.
Last update: 2024-09-23 17:02:14 UTC
README
安装后,将创建一个 BCM 设置页面,可以在此设置自定义值。
为了生成以下元标签,必须在设置页面启用此插件。
存在的元标签
bcm-type
- 必需 - 可在设置页面设置bcm-country
- 必需 - 将自动获取bcm-brand
- 必需 - 可在设置页面设置bcm-sub
- 可选 - 可在设置页面设置bcm-tablet-breakpoint
- 可选 - 可在设置页面设置bcm-mobile-breakpoint
- 可选 - 可在设置页面设置bcm-title
- 在文章页面上自动获取,并由过滤器wp_bcm_set_title
覆盖bcm-content-type
- 将自动获取,对应于 get_fields(get_post()->ID)['kind']bcm-categories
- 在文章页面上自动获取,并由过滤器wp_bcm_set_categories
覆盖bcm-tags
- 在文章页面上自动获取,并由过滤器wp_bcm_set_tags
覆盖bcm-advertorial-type
- 将自动获取,对应于 get_fields(get_post()->ID)['commercial_type']bcm-advertorial-label
- 将自动获取,对应于 pll__(get_fields(get_post()->ID)['commercial_type'])
注意:假设 'commercial_type' 字段值已注册为字符串翻译。
包含脚本
JavaScript 代码将在 wp_footer
动作中插入,其外观如下: <script type="text/javascript" src="https://bcm.interactives.dk/script/#country#/#brand#/#type#"></script>
,其中所有占位符将被上面列表中的正确值替换。
国家代码
将根据当前语言代码从 polylang 插件中获取,并获取相应的国家代码。如果不可能,则从当前的 WordPress 区域设置中获取。
可用的 WordPress 过滤器
- wp_bcm_set_title
add_filter('wp_bcm_set_title', function($strTitle) { // tamper title return $strTitle; });
- wp_bcm_set_categories
add_filter('wp_bcm_set_categories', function($arrCategories) { // tamper with categories return $arrCategories; });
- wp_bcm_set_tags
add_filter('wp_bcm_set_tags', function($arrTags) { // tamper with tags return $arrTags; });
- wp_bcm_set_content_type
add_filter('wp_bcm_set_content_type', function($strContentType) { // tamper content type return $strContentType; });
- wp_bcm_set_advertorial_type
add_filter('wp_bcm_set_advertorial_type', function($arrTags) { // tamper advertorial type return $arrTags; });