2 Click Social Media Buttons
Problem with multiple instances of 2-click [includes possible fix] (5 posts)

  1. rpas
    Posted 3 years ago #


    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).


  2. H.-Peter Pfeufer
    Plugin Author

    Posted 3 years ago #

    I'll take a look for it.

  3. lislis
    Posted 3 years ago #

    I've encountered the same problem. Do you recommend the mentioned fix?

  4. Skarven
    Posted 3 years ago #

    Gibt es da inzwischen eine elegantere und vom Autor geprüfte und empfohlene Lösung?

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    These are English language forums, so please use English. Alternatively, use a WP support forum in your language.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • 2 Click Social Media Buttons
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.