awesomemotive / easy-digital-downloads

Sell digital downloads through WordPress
https://easydigitaldownloads.com
GNU General Public License v2.0
866 stars 474 forks source link

Add support for custom taxonomies in [downloads] shortcode #6084

Open d9media opened 7 years ago

d9media commented 7 years ago

Hey guys, I would like to propose a patch for adding support for custom taxonomies in [downloads]-Shortcodes. We use additional taxonomies such as Genre, Color, etc. so I jumped into the coded and made a few adjustments:

  1. automatically detect all custom taxonomies:
    Array
    (
    [download_category] => 
    [download_tag] => 
    [genre] => 
    [instruments] => 
    [package] => 
    )
  2. if any of these are present in our atts, use it:
    
    Array
    (
    [category] => 
    [exclude_category] => 
    [tags] => 
    [exclude_tags] => 
    [author] => 
    [relation] => OR
    [number] => 12
    [price] => no
    [excerpt] => no
    [full_content] => no
    [buy_button] => no
    [columns] => 2
    [thumbnails] => true
    [orderby] => post_date
    [order] => DESC
    [ids] => 
    [pagination] => true
    [download_category] => 
    [download_tag] => 
    [genre] => 
    [instruments] => 
    [package] => 38
    )

Array ( [package] => 38 )



3. condense the part where tags/categories are queried into a more general approach

The code is working good so far, but I would be very interested what you think about my solution. I think this will be a real benefit.

could we also rewrite this function with a custom plug-in?

[Proposed_patch_to_add_support_for_custom_taxonomies_in_shortcodes.patch.txt](https://github.com/easydigitaldownloads/easy-digital-downloads/files/1391621/Proposed_patch_to_add_support_for_custom_taxonomies_in_shortcodes.patch.txt)
cklosowski commented 7 years ago

@d9media Is it possible for you to submit a pull request with this patch so it can be easily tested by our team without the need to apply patches?

d9media commented 7 years ago

Hey @cklosowski, I personally use SVN so this might take a few minutes but I'll try my best.

cklosowski commented 7 years ago

ok no worries. Much appreciated. If not, let me know and I'll see if I can get the patch to apply cleanly into a PR.

d9media commented 7 years ago

@cklosowski, can you see my pull request? I hope it'll be helpful!

cklosowski commented 7 years ago

@d9media yep, I can see it. We'll have a look at it.

d9media commented 6 years ago

I changed the patch so it passes all checks, can you give feedback?