Enable Downloads in the WP REST API

/** * Adds additional arguments into the post type registration for downloads. * * @param array $download_args The existing array of arguments. * * @return array */ function eddwp_add_rest_for_dls( $download_args ) { $download_args[‘show_in_rest’] = true; $download_args[‘rest_base’] = ‘downloads’; return $download_args;…Continue reading

Remove Product Notes For Specific Downloads

function sumobi_edd_remove_product_notes( $notes, $download_id ) { // enter the download IDs you’d like to exclude into this array $downloads_to_exclude = array( 509, 104, 435 ); if ( in_array( $download_id, $downloads_to_exclude ) ) { return false; } return $notes; } add_filter(…Continue reading

Remove Price

function pw_edd_remove_price( $args ) { $args[‘price’] = ‘no’; return $args; } add_filter( ‘edd_purchase_link_defaults’, ‘pw_edd_remove_price’ );Continue reading

Taxonomy Count

// adjust downloads taxonomy loop function custom_download_tag_count( $query ) { if ( ( $query->is_tax( ‘download_category’ ) || $query->is_tax( ‘download_tag’ ) ) && ! is_admin() && $query->is_main_query() ) { // replace 15 with desired amount $query->set( ‘posts_per_page’, 15 ); } }…Continue reading

Remove Free Text

function pw_edd_remove_free( $form, $args ) { $form = str_replace( ‘Free – Purchase’, ‘Purchase’ , $form ); return $form; } add_filter( ‘edd_purchase_download_form’, ‘pw_edd_remove_free’, 10, 2 );Continue reading

Enable Comments

function pw_edd_comments() { add_post_type_support( ‘download’, ‘comments’ ); } add_action( ‘init’, ‘pw_edd_comments’, 999 );Continue reading

Exclude downloads from search

function sumobi_download_post_type_args( $download_args ) { $download_args[‘exclude_from_search’] = true; return $download_args; } add_filter( ‘edd_download_post_type_args’, ‘sumobi_download_post_type_args’ );Continue reading

Change Number of Downloads in Bundle Select

// Remove original bundle item select field which defaults to 30 items function kjm_remove_old_bundle_field() { remove_action( ‘edd_meta_box_files_fields’, ‘edd_render_products_field’, 10 ); } add_action( ‘plugins_loaded’, ‘kjm_remove_old_bundle_field’ ); // Add back bundle select field with ‘number’ specified function kjm_render_products_field( $post_id ) { $type…Continue reading

Replace Add to Cart with Download

function ck_edd_user_download_button( $purchase_form, $args ) { global $edd_options; if ( !is_user_logged_in() ) { return $purchase_form; } $download_id = (string)$args[‘download_id’]; $current_user_id = get_current_user_id(); // If the user has purchased this item, itterate through their purchases to get the specific // purchase…Continue reading

Show Featured Image With Purchase Link

function sumobi_edd_purchase_link_show_featured_image( $download_id ) { echo get_the_post_thumbnail( $download_id, ‘thumbnail’ ); } add_action( ‘edd_purchase_link_top’, ‘sumobi_edd_purchase_link_show_featured_image’ );Continue reading