Last active
September 4, 2020 14:25
-
-
Save amdrew/71d6880e7a1982889d02 to your computer and use it in GitHub Desktop.
AffiliateWP - Leaderboard. Show the leaderboard via PHP function
This file contains hidden or 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 this where you'd like the leaderboard to be displayed | |
*/ | |
if ( function_exists( 'affwp_custom_show_leaderboard' ) ) { | |
affwp_custom_show_leaderboard(); | |
} | |
?> |
This file contains hidden or 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 | |
/** | |
* Show affiliate leaderboard | |
*/ | |
function affwp_custom_show_leaderboard() { | |
$affiliatewp_leaderboard = function_exists( 'affiliatewp_leaderboard_load' ) ? affiliatewp_leaderboard_load() : null; | |
if ( ! $affiliatewp_leaderboard ) { | |
return; | |
} | |
echo '<h1>Top Affiliates</h1>'; | |
$args = array( | |
'number' => 10, // default | |
'referrals' => 'yes', // yes (default) | no | |
'visits' => 'no', // yes | no | |
'earnings' => 'no', // yes | no | |
'orderby' => 'referrals' // referrals | visits | earnings | |
); | |
echo $affiliatewp_leaderboard->show_leaderboard( $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how show fillter by date? this month, july etc