Problem with multiple instances of 2-click [includes possible fix]
-
Hi,
when I tried to include the 2-socialmedia-buttons twice in my template, the plugin created a bunch of buttons (about 6 times for each button bar) and everything fell apart.
After examining the problem I came up with a solution for this by fixing the libs/class-twoclick-frontend.php-file
@@ -979,9 +979,10 @@ if(!class_exists('Twoclick_Social_Media_Buttons_Frontend')) {
} // END if($this->array_TwoclickButtonsOptions['twoclick_buttons_url_tracking'] === true)
$array_ButtonData['display_infobox'] = ($this->array_TwoclickButtonsOptions['twoclick_buttons_display_in- $var_sJavaScript = '/* <![CDATA[ */' . "\n" . 'jQuery(document).ready(function($){if($(\'.twoclick_socia
+ $var_sPostID_uniq = $var_sPostID . '_' . rand(1000,9999);
+ $var_sJavaScript = '/* <![CDATA[ */' . "\n" . 'jQuery(document).ready(function($){if($(\'.twoclick_socia- return $this->_get_intro() . '<div class="twoclick_social_bookmarks_post_' . $var_sPostID . ' social_sha
+ return $this->_get_intro() . '<div class="twoclick_social_bookmarks_post_' . $var_sPostID_uniq . ' socia
} // END if(!is_admin())
} // END function _get_js($var_sPostID = '')This patch will make sure that the markup-generation generation in JS will work on just one element at a time (as the $var_sPostID-variable won’t be unique anymore if you include more than once).
Maybe the author of this plugin can incorporate this fix or any other solution for this problem in a future version of this very cool plugin.
Note: Currently this fix will not take care of synchronizing the toggle-buttons directly (e.g. activating FB on the first button bar will not activate FB on the second button bar).
http://wordpress.org/extend/plugins/2-click-socialmedia-buttons/
- The topic ‘Problem with multiple instances of 2-click [includes possible fix]’ is closed to new replies.