Ability to Order files in wpdm_tree [WPDM Extended Shortcodes]

in Download Manager Pro Feature Request

Viewing 8 posts - 1 through 8 (of 8 total)
Mar 17, 2016 at 5:03 pm
#42802
Member
brunzino
OP

Currently the wpdm_tree shortcode displays files within the folders ordered by ‘post_date’. I wanted to order them by ‘title’ instead so I’ve updated the WPDM Extended Shortcodes plugin file https://wordpress.org/support/topic/how-to-order-documents-within-wpdm_tree-wpdm-extended-shortcodes-workaround?replies=1#post-8161730

It looks simple enough to add that parameter to the shortcode and send with the AJAX request. I will try to make the updates this week.

Thanks a lot!

Mar 17, 2016 at 5:59 pm
#42809
Member
brunzino
OP

Included is the updated file, with a git-diff of the original plugin file and the updated file.

This update allows the wpdm_tree shortcode to accept order_by and order parameters, in accordance with the capabilities of WP_QUERY()

[wpdm-extended-shortcodes.php]
It first accepts the parameters and assigns the current default values (order_by = ID, order = DESC) if not defined. (~ line 21)
Sends these parameters in the AJAX request. (~line 30)
Accepts the AJAX parameters (~line 410) and applies them to the WP_QUERY() params (~line 420)

Example:
[wpdm_tree category="policy-documents" download_link="1" order_by="title" order="ASC" ]

Thanks again and I hope this helps!

Mar 17, 2016 at 6:02 pm
#42811
Member
brunzino
OP

Doesn’t accept php files, here’s a .tar

Mar 17, 2016 at 6:25 pm
#42814
Member
brunzino
OP

Test Cases:

// No values
[wpdm_tree category=”agency-policy” download_link=”1″]

// Valid values
[wpdm_tree category=”agency-policy” download_link=”1″ order_by=”title” order=”ASC” ]

// Invalid Values
[wpdm_tree category=”agency-policy” download_link=”1″ order_by=”SOMETHING_IMPOSSIBLE” order=”NOT_ASC_OR_DESC” ]

Mar 17, 2016 at 6:26 pm
#42815
Member
brunzino
OP

The default value for order_by should be ‘date’ NOT ‘ID’ . This is the current default for WP_QUERY and should persist.

Mar 17, 2016 at 6:27 pm
#42816
Member
brunzino
OP

Also, $order should probably be strtoupper($order) as WP_QUERY only accepts upper case for that option.

Jan 4, 2018 at 4:34 am
#67504

While the files appear to order as expected, child categories don’t… or is there a separate way to indicate how those should be sorted? On my page I have the main category “Council Meeting Minutes” and then sub categories for “2018”, “2017”, etc. The files sort by date as hoped, but not the child categories.

This is the shortcode I’m using: [wpdm_tree download_link=1 category=”city-council-meeting-minutes” orderby=”date”]

Jan 4, 2018 at 8:44 pm
#67520

I installed https://wordpress.org/plugins/taxonomy-terms-order/ and was able to get the category order the way I wanted.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic "Ability to Order files in wpdm_tree [WPDM Extended Shortcodes]" is closed to new replies.