benjaminmedia/wp-bcm-manager

此包最新版本(1.1.6)没有可用的许可信息。

BCM 管理器

安装次数: 2,789

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 12

分支: 0

公开问题: 0

类型:wordpress-plugin

1.1.6 2021-04-23 09:37 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;
});