-
-
Notifications
You must be signed in to change notification settings - Fork 14
Social Networks
Chris Carlevato edited this page Feb 24, 2019
·
1 revision
utm.codes makes it easy to add custom social networks for batch link creation using the WordPress Plugin API. The filter callback function receives an array of default network options that can be updated to your specific needs.
Change the list of available social networks allowing new options for batch created social links.
The array returned by your filter callback is sorted by key (ksort()
) before render of the settings page so you don't have to worry about the order of your changes.
$networks['SOCIAL_SOURCE'] = [ 'LABEL', 'CSS_CLASSES' ];
- SOCIAL_SOURCE: utm_source value for created links. This value is passed through to analytics reporting in your created links.
- LABEL: Name displayed within the admin console settings page. Not used as part of created links.
- CSS_CLASSES: CSS classes for rendering an icon displayed within the admin console settings page. Not used as part of created links.
Tip: utm.codes uses Font Awesome Free v5.7, search available icons here to locate icon css classes for use with your custom network options.
/**
* Customize social sources setting options adding a new entry for dev.to.
* Adds source 'dev-to' to batch created social links.
*/
add_filter(
'utmdc_social_sources',
function( $networks ) {
$networks['dev-to'] = [ 'Dev.to', 'fab fa-dev' ];
return $networks;
}
);
/**
* Customize social sources setting options by removing entry for Google+.
* Prevents use of Google+ as source for batch created social links.
*/
add_filter(
'utmdc_social_sources',
function( $networks ) {
unset( $networks['googleplus'] );
return $networks;
}
);
utm.codes is proudly open source software.