Permalink
Browse files

added twitter share button

  • Loading branch information...
1 parent deaeb42 commit df51b1369bd823785d011847766848769d61985e @Torthu committed Apr 10, 2012
Showing with 41 additions and 17 deletions.
  1. +11 −4 single.php
  2. +30 −13 style.css
View
@@ -54,9 +54,9 @@
<div class="six_cols center cf share">
<h2>Del</h2>
<a href="https://www.facebook.com/sharer.php?u=<?php echo urlencode(get_permalink()); ?>&t=<?php echo urlencode(get_the_title()); ?>" class="facebook_share" title="Del på Facebook">Del på facebook</a>
-
- <a href="https://twitter.com/share" class="twitter-share-button twitter_share" style="float:left;" data-via="Kvarteret" data-lang="no">Tweet</a>
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+ <a href="http://twitter.com/share?url=<?php echo urlencode(get_permalink()); ?>&text=<?php the_title(); ?>&via=Kvarteret" target="_blank" onClick="tweetpopup(); return false;" rel="nofollow" class="twitter_share" alt="Del på Twitter">Tweet</a>
+ <!--<a href="https://twitter.com/share" class="twitter-share-button twitter_share" data-via="Kvarteret" data-lang="no">Tweet</a>
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>-->
</div>
@@ -75,7 +75,7 @@ function(data) {
tweets = data.story.url_count;
console.log('tweets' + data.story.url_count);
}
- $('.twitter_share').after(tweets);
+ $('.twitter_share').append('<div class="count">' + tweets + '</div>');
});
// Get number of Likes (Shares + likes + mentions)
@@ -89,6 +89,13 @@ function(data) {
$('.facebook_share').append('<div class="count">' + shares + '</div>');
});
});
+
+
+/*function tweetpopup() {
+
+ window.open( "http://twitter.com/share?url=<?php echo urlencode(get_permalink()); ?>&text=the%20text%20you%20wish%20the%20tweet%20to%20say&count=none/", "tweet", "height=450,width=550,resizable=1" )
+
+}*/
</script>
<?php get_footer(); ?>
View
@@ -718,6 +718,18 @@ px 68 160 252 344 436 528 620 712 804 896 */
margin-bottom: 0;
}
+ .facebook_share .count, .twitter_share .count {
+ position: absolute;
+ top: 50%;
+ margin-top: -10px;
+ padding: 2px;
+ background: #fff;
+ border-radius: 2px;
+ color: #333;
+ line-height: 16px;
+ text-indent: 0;
+ }
+
.facebook_share {
float:left;
height: 48px;
@@ -731,16 +743,7 @@ px 68 160 252 344 436 528 620 712 804 896 */
background-color: #284977;
}
.facebook_share .count {
- position: absolute;
left: 55px;
- top: 50%;
- margin-top: -10px;
- padding: 2px;
- background: #fff;
- border-radius: 2px;
- color: #333;
- line-height: 16px;
- text-indent: 0;
}
.facebook_share .count:before {
border-right: 5px solid #fff;
@@ -755,12 +758,26 @@ px 68 160 252 344 436 528 620 712 804 896 */
.twitter_share {
float:right;
- height: 24px;
- width: 24px;
- background: #35619E;
+ height: 48px;
+ width: 48px;
+ background: url(images/twitter-share.png) no-repeat center center #3C8FC9;
border-radius: 5px;
+ text-indent: -9999px;
+ position: relative;
}
-
+ .twitter_share .count {
+ right: 55px;
+ }
+ .twitter_share .count:before {
+ border-left: 5px solid #fff;
+ border-top: 5px solid transparent;
+ border-bottom: 5px solid transparent;
+ content: ' ';
+ position: absolute;
+ right: -5px;
+ top: 50%;
+ margin-top: -5px;
+ }
.date_wrap {
width: 90px;
}

0 comments on commit df51b13

Please sign in to comment.