Created
April 23, 2019 20:06
-
-
Save robincornett/99c241171708a24a7b895b8607945cd0 to your computer and use it in GitHub Desktop.
Add a hashtag to all Twitter sharing buttons on a site (in Scriptless 3.0.0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'scriptlesssocialsharing_twitter_query_args', 'prefix_add_twitter_hashtag_scriptless' ); | |
/** | |
* Add a hashtag to every Twitter button on a site. | |
* Requires Scriptless Social Sharing 3.0.0 | |
* | |
* @param $query_args | |
* @return mixed | |
*/ | |
function prefix_add_twitter_hashtag_scriptless( $query_args ) { | |
$query_args['text'] .= rawurlencode( ' #hashtag' ); | |
return $query_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actually, this could be done in the current version of Scriptless with the
scriptlesssocialsharing_twitter_text
filter. Example:Actually, this filter is also added in 3.0, so it's not available yet either. My apologies for the error.