Skip to content

Instantly share code, notes, and snippets.

@yurivictor
Created January 6, 2014 15:51
Show Gist options
  • Save yurivictor/8284794 to your computer and use it in GitHub Desktop.
Save yurivictor/8284794 to your computer and use it in GitHub Desktop.
Proper tweet encoding for WordPress headlines
<a data-social-name="twitter" href="javascript:void( 0 )" onclick="window.open( 'http://www.twitter.com/intent/tweet?text=<?php echo htmlspecialchars( urlencode( html_entity_decode( get_the_title(), ENT_COMPAT, 'UTF-8' ) ), ENT_COMPAT, 'UTF-8' ); ?>&url=<?php echo get_permalink() ?>','','width=550, height=350, scrollbars=no' )">Twitter</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment