I'm trying to make a Custom Twitter Button in my content.php so where it's placed at the bottom of each post and a button appears that when clicked it can send a Tweet this to Twitter with the post id's url. However, I can't figure out this "bug" that I'm running into and I thought possibly one of you Stackoverflow Wordpress users would know.
So below is some code from my content.php and when I have just the a href link added the button works and can fetch the url. So when clicked on example it will go to twitter and have the url as myblog.com/mattspost-111. Do note that only the text shows and not the twitter bubble with how many tweets have been tweeted.
<span class="social"> <!-- Twitter --> <a href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>" class="twitter-share-button" data-via="MattStenquist" data-lang="en" data-size="large" data-related="MattStenquist">Tweet</a></div>
However, when I add the full code including Twitters < script >< /script > statement when the button is clicked all it does is pull up the url of the blog for example. myblog.com/blog not the post associated with it.
<span class="social">
<!-- Twitter -->
<a href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>" class="twitter-share-button" data-via="MattStenquist" data-lang="en" data-size="large" data-related="MattStenquist">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>
In short, all I want is so I can have a universal twitter button on the categories page that fetches the posts url, when in category mode and when in just viewing the post.