Wordpress bcm manager plugin
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 pagebcm-country
- required - this will be fetched automaticallybcm-brand
- required - can be set in settings pagebcm-sub
- optional - can be set in settings pagebcm-tablet-breakpoint
- optional - can be set in settings pagebcm-mobile-breakpoint
- optional - can be set in settings pagebcm-title
- automatically fetched on article page and overwritten by filterwp_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 filterwp_bcm_set_categories
bcm-tags
- automatically fetched on article page and overwritten by filterwp_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;
});