Site logo

Archived topic

Click to Tweet box

1 reply · Started by Jason on June 17, 2020

Viewing posts 1–2 of 2

I found this old thread and have found it works well to allow me to replace the Better Click to Tweet plugin.
I have altered the code slightly to resemble the output of the previous plugin. I would like to be able to use the shortlink instead of full URL. I am unfortunately not down with js coding at the level required.
I know this is probably outside of GP related support directly but would you be able to suggest how I need to change this code to get the shortlink instead?
Thanks!

<script>
jQuery(document).ready(function($){
	// Tweet blockquote	
	$('blockquote.tweet').each(function(){
		var quote = $(this);
		quote.append( '<a target="_blank" href="https://twitter.com/intent/tweet?url=' + window.location.href  + '&text=' + quote.text() + '&via=@YOURHANDLE&related=@YOURHANDLE" class="twitter-share-button icon-twitter" data-text="' + quote.text() + '" data-lang="en">Tweet this</a>' );
	});
});
</script>
This archived topic is closed to new replies.