benjaminmedia/wp-bcm-manager

There is no license information available for the latest version (1.1.6) of this package.

BCM manager

Installs: 2 775

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 12

Forks: 0

Open Issues: 0

Type:wordpress-plugin

1.1.6 2021-04-23 09:37 UTC

README

When installed it will create a BCM settings page where custom values can be set.

In order to generate the following meta tags this plugin must be enabled from the settings page.

Meta tags present

  • bcm-type - required - can be set in settings page
  • bcm-country - required - this will be fetched automatically
  • bcm-brand - required - can be set in settings page
  • bcm-sub - optional - can be set in settings page
  • bcm-tablet-breakpoint - optional - can be set in settings page
  • bcm-mobile-breakpoint - optional - can be set in settings page
  • bcm-title - automatically fetched on article page and overwritten by filter wp_bcm_set_title
  • bcm-content-type - this will be fetched automatically and corresponds to get_fields(get_post()->ID)['kind']
  • bcm-categories - automatically fetched on article page and overwritten by filter wp_bcm_set_categories
  • bcm-tags - automatically fetched on article page and overwritten by filter wp_bcm_set_tags
  • bcm-advertorial-type - this will be fetched automatically and corresponds to get_fields(get_post()->ID)['commercial_type']
  • bcm-advertorial-label - this will be fetched automatically and corresponds to pll__(get_fields(get_post()->ID)['commercial_type'])

Note: The 'commercial_type' field values are presumed to have been registered as string translations.

Inclusion script

The javascript code will be inserted at wp_footer action and it looks like: <script type="text/javascript" src="https://bcm.interactives.dk/script/#country#/#brand#/#type#"></script>, where all the placeholders will be replaced by correct ones from above listing.

Country code

This will be fetched from polylang plugin by looking at the current language code and fetching the proper country code. If that is not possible then it will be fetched from current wordpress locale.

Worpress filters available

  • 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;
});