Making WordPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#1016 closed enhancement (fixed)

Allow usage of uppercase 'ASC'/'DESC' to order in shortcode_speakers

Reported by: pixolin's profile pixolin Owned by: iandunn's profile iandunn
Milestone: Priority: normal
Component: WordCamp Site & Plugins Keywords: has-patch
Cc:

Description

I got somewhat confused when using the shortcode to list speakers on the website for our WordCamp Cologne:

I added a parameter order="ASC" as I usually do when adding a new WP_Query() in a template, but to no avail. After several attempts I looked into the plugin source code and found out, the shortcode [speakers] only accepts the parameter order in lowercase, which then gets turned into uppercase by function [parse order](https://core.trac.wordpress.org/browser/tags/4.2.1/src/wp-includes/query.php#L2311) (introducded in WordPress 3.9).

A simple workaround would be to add $attr['order'] = strtolower( $attr['order'] ); to improve handling of the shortcode.

Attachments (2)

wc-post-types-diff.php (650 bytes) - added by pixolin 9 years ago.
Patch for ticket #1016
wc-post-types.diff (650 bytes) - added by pixolin 9 years ago.
Sorry for sending the diff file with wrong file extension. :)

Download all attachments as: .zip

Change History (5)

@pixolin
9 years ago

Patch for ticket #1016

@pixolin
9 years ago

Sorry for sending the diff file with wrong file extension. :)

#1 @iandunn
9 years ago

  • Owner set to iandunn
  • Resolution set to fixed
  • Status changed from new to closed

In 1539:

WordCamp Post Type: Accept shortcode parameters regardless of case.

Fixes #1016
Props pixolin

#2 @iandunn
9 years ago

This was actually a problem for many parameters across multiple shortcodes, so r1539 expanded on your patch a bit, but wc-post-types.diff was a good first step.

Thanks for taking the time to dig into why this was happening, and then reporting and patching it :)

#3 @iandunn
9 years ago

In 1540:

WordCamp Post Types: Maintain boolean values during str_to_bool() conversion.

This fixes a bug introduced in r1539 where a boolean passed to this function would be unintentionally converted to a string, but later treated as though it might still be a boolean.

See #1016
See https://wordpress.slack.com/archives/meta/p1430769561000761

Note: See TracTickets for help on using tickets.