Title: [downloads] shortcode &#8211; loop for empty
Last modified: August 30, 2016

---

# [downloads] shortcode – loop for empty

 *  Resolved [odie2](https://wordpress.org/support/users/odie2/)
 * (@odie2)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/downloads-shortcode-loop-for-empty/)
 * Hi,
 * I gone wild and created own tree for downloads (see [Dokumenty](http://zschocianow.pl/pliki/dokumenty/)).
 * It looks like:
 *     ```
       '[downloads
       	category="'. $category['slug'] .'"
       	category_include_children="false"
       	template="button"
       	loop_start="<div class=\'download-category\'><'. $tag .'><a href=\''. get_permalink() . $category['slug'] .'/\'>'. $category['name'] .'</a></'. $tag .'>"
       	loop_end="'. htmlspecialchars($children) .'</div>"
       	before=""
       	after=""
       ]'
       ```
   
 * Where:
    - `$category` is current category (from friendly URL).
    - `$tag` is hierarchical number for header.
    - `$children` is calling to itself of function – `$children = ( count( $category['
      children'] ) ? print_categories( $category['children'], $i_tag + 1 ) : '' );`.
 * I have one of main category, which have nothing in itself – [Pozostałe pliki](http://zschocianow.pl/pliki/pozostale/)–
   however childrens have, for example [Pozostałe 2011/2012](http://zschocianow.pl/pliki/pozostale-2011-12/)
 * As you can see they appears in dropdown and [files’ main page](http://localhost/wordpress/pliki/)
   as I set `'hide_empty' => false,` for queries.
    Can I set something similar to`[
   downloads]` shortcode, as I don’t see anything related in [documentation](https://www.download-monitor.com/kb/shortcode-downloads/)(`
   category_include_children` don’t do the job as then files are cloned under parent
   and children)? As summary – I need to `loop_start` and `loop_end` were executed
   depending not on if certain category is empty of files.
 * _(Maybe I could check for source code for myself, but I will fall asleep in a
   moment and maybe above code will be useful for future readers.)_
 * Thanks in advance,
    Greetings
 * [https://wordpress.org/plugins/download-monitor/](https://wordpress.org/plugins/download-monitor/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [odie2](https://wordpress.org/support/users/odie2/)
 * (@odie2)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/downloads-shortcode-loop-for-empty/#post-6465380)
 * Anyone?
 *  Plugin Contributor [Barry Kooij](https://wordpress.org/support/users/barrykooij/)
 * (@barrykooij)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/downloads-shortcode-loop-for-empty/#post-6465396)
 * What you’re looking for here is custom development and unfortunately I can’t 
   help you with that. I suggest you ask your question somewhere created for these
   kind of questions like wordpress.stackexchange.com or consider hiring a developer.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[downloads] shortcode – loop for empty’ is closed to new replies.

 * ![](https://ps.w.org/download-monitor/assets/icon-256x256.png?rev=3198936)
 * [Download Monitor](https://wordpress.org/plugins/download-monitor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/download-monitor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/download-monitor/)
 * [Active Topics](https://wordpress.org/support/plugin/download-monitor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/download-monitor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/download-monitor/reviews/)

## Tags

 * [children](https://wordpress.org/support/topic-tag/children/)
 * [downloads](https://wordpress.org/support/topic-tag/downloads/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [parent](https://wordpress.org/support/topic-tag/parent/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 2 replies
 * 2 participants
 * Last reply from: [Barry Kooij](https://wordpress.org/support/users/barrykooij/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/downloads-shortcode-loop-for-empty/#post-6465396)
 * Status: resolved