[wp-trac] [WordPress Trac] #29629: Shortcode playlist random order parameter can't work

WordPress Trac noreply at wordpress.org
Fri Sep 12 00:18:29 UTC 2014


#29629: Shortcode playlist random order parameter can't work
--------------------------+------------------
 Reporter:  ialocin       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.1
Component:  Media         |     Version:  4.0
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------

Comment (by Otto42):

 It appears that some of this was copied from the gallery shortcode and
 that the documentation was written somewhat incorrectly.

 In short, this is wrong:

 {{{
  *     @type string  $order        Designates ascending or descending
 order of items in the playlist.
  *                                 Accepts 'ASC', 'DESC', or 'RAND'.
 Default 'ASC'.
  *     @type string  $orderby      Any column, or columns, to sort the
 playlist. If $ids are
  *                                 passed, this defaults to the order of
 the $ids array ('post__in').
  *                                 Otherwise default is 'menu_order ID'.
 }}}

 To get a random order, the "orderby" parameter should be set to "rand" and
 the value of the "order" parameter is somewhat irrelevant. It can be ASC
 or DESC, but it's just sorting random numbers at that point.

 These lines can be removed entirely. I don't know why they're in the
 gallery shortcode or in this shortcode, but they're perfectly useless:

 {{{
 if ( 'RAND' == $atts['order'] ) {
      $atts['orderby'] = 'none';
 }
 }}}


 And the documentation in the function header should reflect that "orderby"
 is what can be "rand", not "order". These values are passed through to the
 same values in WP_Query, and the parse_query() function there correctly
 documents their usage.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29629#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list