Created
December 7, 2016 10:22
-
-
Save michaeluno/caef45d979d8d24d7c17c0aaf9515d62 to your computer and use it in GitHub Desktop.
A WordPress plugin that modifies the `count` parameter value of the API request query string made by the Fetch Tweets plugin.
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 | |
/** | |
* Plugin Name: Fetch Tweets - Modify Count | |
* Description: Modifies the `count` parameter value of the API request query string. | |
* Version: 0.0.1 | |
*/ | |
class FetchTweetsModifyCount { | |
public function __construct() { | |
add_filter( 'fetch_tweets_filter_api_request_uri', array( $this, 'replyToModifyRequestURI' ) ); | |
} | |
public function replyToModifyRequestURI( $sURI ) { | |
$_aArguments = wp_parse_args( $sURI, array( 'count' => 100 ) ); | |
if ( $_aArguments[ 'count' ] > 100 ) { | |
return $sURI; | |
} | |
$sURI = remove_query_arg( array( 'count' ), $sURI ); | |
return add_query_arg( | |
array( 'count' => 100 ), | |
$sURI | |
); | |
} | |
} | |
new FetchTweetsModifyCount; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment