Created
February 6, 2014 19:50
-
-
Save williamsba/8851321 to your computer and use it in GitHub Desktop.
Return only the latest product version on the front-end in Easy Digital Downloads
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
add_filter( 'edd_download_files', 'appp_show_latest_product_version' ); | |
function appp_show_latest_product_version( $files ) { | |
//only show the latest version of a product everywhere except the admin dashboard | |
if ( is_array( $files ) && ! is_admin() ) { | |
//count the file array size | |
$arr_count = count( $files ); | |
//store only the last array value, which is the latest product version | |
$files = array_slice( $files, $arr_count - 1 ); | |
} | |
return $files; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment