Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Added menu_order to the orderby attribute of the shortcode #169

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/delightful-downloads/includes/shortcodes.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ function dedo_shortcode_ddownload_list( $atts ) {
$query_args['posts_per_page'] = ( 0 === $limit ) ? -1 : $limit;

// Validate and set orderby
if ( !in_array( strtolower( $orderby ), array( 'title', 'date', 'count', 'filesize', 'random' ) ) ) {
// Shortcode needs also the menu_order so that we can use it with Intuitive Custom Post Order
if ( !in_array( strtolower( $orderby ), array( 'title', 'date', 'count', 'menu_order','filesize', 'random' ) ) ) {

return __( 'Invalid orderby attribute.', 'delightful-downloads' );
}
Expand All @@ -155,6 +156,10 @@ function dedo_shortcode_ddownload_list( $atts ) {
case 'date':
$query_args['orderby'] = 'date';
break;

case 'menu_order':
$query_args['orderby'] = 'menu_order';
break;

case 'count':
$query_args['meta_key'] = '_dedo_file_count';
Expand Down