Skip to content

Instantly share code, notes, and snippets.

@SeanChDavis
Last active August 29, 2015 14:12
Show Gist options
  • Save SeanChDavis/a6fdc48a7e710d7e2be7 to your computer and use it in GitHub Desktop.
Save SeanChDavis/a6fdc48a7e710d7e2be7 to your computer and use it in GitHub Desktop.
EDD show automatic purchase button below content on download category archives
<?php // DO NOT COPY THIS LINE
/**
* remove original filter that adds purchase button below download content
*/
remove_filter( 'the_content', 'edd_after_download_content' );
/**
* add new filter that adds "is_archive()" to the conditional so
* that the button will also show on downloads archives
*/
function custom_edd_after_download_content( $content ) {
global $post;
if ( $post && $post->post_type == 'download' && ( is_singular( 'download' ) || is_archive( 'download' ) ) && is_main_query() && !post_password_required() ) {
ob_start();
do_action( 'edd_after_download_content', $post->ID );
$content .= ob_get_clean();
}
return $content;
}
add_filter( 'the_content', 'custom_edd_after_download_content' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment