Skip to content

Instantly share code, notes, and snippets.

@bentideswell
Last active October 14, 2019 14:39
Show Gist options
  • Save bentideswell/7b482fa1cea1a7c98167ed3ed642215a to your computer and use it in GitHub Desktop.
Save bentideswell/7b482fa1cea1a7c98167ed3ed642215a to your computer and use it in GitHub Desktop.
Code to add support for Social Pug plugin to FishPig_WordPress
<?php
/**
* Add this code to your local.php in the FishPig theme
* wp-content/themes/fishpig/local.php
*
* This code stops the Social Pug plugin in WordPress from displaying the floating
* social buttons twice.
*
* This works for FishPig_WordPress for Magento 1 and Magento 2
* It also requires the Shortcodes & Widgets add-on module:
*
* https://fishpig.co.uk/magento/wordpress-integration/shortcodes-widgets/
*
*/
add_filter('dpsp_is_location_displayable', function($return, $location_slug, $settings) {
global $dspLocationDisplayableCache;
if (!$return) {
return $return;
}
if ($location_slug !== 'sidebar') {
return $return;
}
if (!isset($dspLocationDisplayableCache)) {
$dspLocationDisplayableCache = array();
}
if (isset($dspLocationDisplayableCache[$location_slug])) {
$return = false;
}
else {
$dspLocationDisplayableCache[$location_slug] = 1;
$return = true;
}
return $return;
}, 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment