When using Scriptless Social Sharing, you may want to add a site wide hashtag to all of your tweets.
e.g. I might want to add #learnIronCode
to all of the tweets created with the Twitter share button.
Before Adding Hashtag
Never use git push force
salferrarello.com/never-git-push-force/
via @salcode
After Adding Hashtag
Never use git push force #learnIronCode
salferrarello.com/never-git-push-force/
via @salcode
Code to Add
Note The author of Scriptless Social Sharing, Robin Cornett, was kind enough to point out there is an even better way to do this than I had originally posted. I’ve updated this post to use her code.
add_filter( 'scriptlesssocialsharing_twitter_url', function ( $url ) {
$hashtag = '#myHashTag';
return str_replace(
'&url=',
'%20' . rawurlencode( $hashtag ) . '&url=',
$url
);
});
Leave a Reply