The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Delightful Downloads
Custom ddownload_list layouts (2 posts)

  1. feisar
    Posted 2 years ago #

    I notice in the documentation for ddownload_list it say's "You can modify the [ddownload_list] shortcode output using the dedo_shortcode_ddownload_list filter."

    Could you expand on this and perhaps advise how I might implement a pop-up select menu for downloads, rather than the current bulleted list?

    I'm familiar with PHP but only just starting out with custom WP development.

    What I'd really like to do, is have the 5 most recent downloads (by date) shown as a bulleted list (as they do by default), but then have all earlier downloads hidden behind a pop-up select menu.

    Is this do-able?


  2. A5hleyRich
    Plugin Author

    Posted 2 years ago #

    Hi there,

    The filter isn't going to be very helpful in this situation as it simply returns a long string, like so:

    <ul class="ddownloads_list"><li><a href="">download1</a></li><li><a href="">download2</a></li></ul>

    While you may be able to explode the different chunks into an array it really doesn't make sense to use this approach. A better way would be to use the WP_Query class, which is actually how the shortcodes are generated. As downloads are post types a simple query would retrieve all downloads in date order. You then just need to loop over the results and add the appropriate HTML markup, with a few if statements.

    $downloads_list = new WP_Query( array( 'post_type' => 'dedo_download', 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'date' ) );

    That should give you enough insight to get started. Any questions, let me know.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Delightful Downloads
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic