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?
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.
- The topic ‘Custom ddownload_list layouts’ is closed to new replies.