Asynchroner Twitter-Button für Wordpress Blogs


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. $asynctwitter_your_screen_name = 'deluxe_domina';
  3. $asynctwitter_your_blog_uri = 'http://www.deluxe-site.com';
  4. $asynctwitter_your_blog_title = 'Diamond Deluxe - berührbare Domina in Düsseldorf';
  5. ?>
  6. <script type="text/javascript">
  7. /* async, non-blocking twitter script */
  8. (function() {
  9. var s = document.createElement("SCRIPT");
  10. var c = document.getElementsByTagName("script")[0];
  11. s.type = "text/javascript";
  12. s.async = true;
  13. s.src = "http://platform.twitter.com/widgets.js";
  14. c.parentNode.insertBefore(s, c);
  15. })();
  16. </script><a
  17. href="http://twitter.com/share?url=<?php echo(urlencode('<?php echo($asynctwitter_your_blog_uri); ?>'.$_SERVER['REQUEST_URI'])); ?>"
  18. class="twitter-share-button"
  19. data-count="horizontal"
  20. data-via="<?php echo($asynctwitter_your_screen_name); ?>"
  21. data-text="<?php
  22. $output = wp_title('-', false, 'right');
  23. $output = preg_replace('/&#8211;/ui', '-', $output);
  24. $output .= $asynctwitter_your_blog_title;
  25. if($paged > 0) {
  26. $output .= ' (Seite '.$paged.')';
  27. }
  28. $output = mb_substr($output, 0, 100, 'UTF-8').'...';
  29. echo($output);
  30. ?>">Tweet</a>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.