edd_add_download_filters

Add Download Filters.

Description

edd_add_download_filters(); 

Adds taxonomy drop down filters for downloads.


Usage

  1. if ( !function_exists( 'edd_add_download_filters' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'easy-digital-downloads/includes/admin/downloads/dashboard-columns.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = edd_add_download_filters(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/downloads/dashboard-columns.php  
  1. function edd_add_download_filters() { 
  2. global $typenow; 
  3.  
  4. // Checks if the current post type is 'download' 
  5. if ( $typenow == 'download') { 
  6. $terms = get_terms( 'download_category' ); 
  7. if ( count( $terms ) > 0 ) { 
  8. echo "<select name='download_category' id='download_category' class='postform'>"; 
  9. $category_labels = edd_get_taxonomy_labels( 'download_category' ); 
  10. echo "<option value=''>" . sprintf( __( 'Show all %s', 'easy-digital-downloads' ), strtolower( $category_labels['name'] ) ) . "</option>"; 
  11. foreach ( $terms as $term ) { 
  12. $selected = isset( $_GET['download_category'] ) && $_GET['download_category'] == $term->slug ? ' selected="selected"' : ''; 
  13. echo '<option value="' . esc_attr( $term->slug ) . '"' . $selected . '>' . esc_html( $term->name ) .' (' . $term->count .')</option>'; 
  14. echo "</select>"; 
  15.  
  16. $terms = get_terms( 'download_tag' ); 
  17. if ( count( $terms ) > 0) { 
  18. echo "<select name='download_tag' id='download_tag' class='postform'>"; 
  19. $tag_labels = edd_get_taxonomy_labels( 'download_tag' ); 
  20. echo "<option value=''>" . sprintf( __( 'Show all %s', 'easy-digital-downloads' ), strtolower( $tag_labels['name'] ) ) . "</option>"; 
  21. foreach ( $terms as $term ) { 
  22. $selected = isset( $_GET['download_tag']) && $_GET['download_tag'] == $term->slug ? ' selected="selected"' : ''; 
  23. echo '<option value="' . esc_attr( $term->slug ) . '"' . $selected . '>' . esc_html( $term->name ) .' (' . $term->count .')</option>'; 
  24. echo "</select>"; 
  25.  
  26. if ( isset( $_REQUEST['all_posts'] ) && '1' === $_REQUEST['all_posts'] ) { 
  27. echo '<input type="hidden" name="all_posts" value="1" />'; 
  28. } else if ( ! current_user_can( 'view_shop_reports' ) ) { 
  29. $author_id = get_current_user_id(); 
  30. echo '<input type="hidden" name="author" value="' . esc_attr( $author_id ) . '" />'; 
  31.