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 $popular_items = new WP_Query (array( | |
'post_type' => 'download', | |
'orderby' => 'meta_value_num', | |
'meta_query' => array( | |
'relation' => 'AND', | |
array( | |
'key' => '_edd_download_sales', | |
'compare' => '>', | |
'value' => 0, | |
'order' => 'DESC', |
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 code in your functions.php file. | |
function rm_total_download( $username = false, $args = array() ) { | |
if( $username ) { | |
$params = array( | |
'timeout' => 10, | |
'sslverify' => false | |
); |
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 | |
function rm_edd_format_amount_decimals( $decimals, $amount ) { | |
if ( floor( $amount ) == $amount ) | |
$decimals = 0; | |
return $decimals; | |
} | |
add_filter( 'edd_format_amount_decimals', 'rm_edd_format_amount_decimals', 10, 2 ); |
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 | |
//Besides administrator show only the current user media files | |
function show_current_user_attachments( $query ) { | |
if ( ! current_user_can('administrator') ) { | |
$user_id = get_current_user_id(); | |
if ( $user_id ) { | |
$query['author'] = $user_id; | |
} | |
} |
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 | |
/** | |
* Beside administrator show only image media files. | |
* | |
* @param [type] $query | |
* @return void | |
*/ | |
function show_only_image_media_files( $query ) { |