Description
Implement "oik_shortcode_atts" for oik-fieldsConverts Standard relational operators into those needed by WordPress's use of MySQL
- This code implements a workaround for TRAC #29608
- The function is shortcode insensitive.
- It applies for any use of the meta_compare attribute
- See https://en.wikipedia.org/wiki/Relational_operator#Standard_relational_operators
- It doesn't cater for "between", where we need to convert it to a meta_query later on
Usage
$array = oik_fields_shortcode_atts( $atts, $content, $tag );Parameters
- $atts
- ( array ) required – shortcode attributes
- $content
- ( string ) required –
- $tag
- ( mixed ) required –
Returns
array updated array of $attsSource
File name: oik-fields/oik-fields.phpLines:
1 to 16 of 16
function oik_fields_shortcode_atts( $atts, $content, $tag ) { bw_trace2( null, null, true, BW_TRACE_DEBUG ); $meta_compare = bw_array_get( $atts, "meta_compare", null ); if ( $meta_compare ) { $meta_compare = strtolower( $meta_compare ); $conversions = array( "eg" => "=" , "ne" => "<>", "gt" => ">", "lt" => "<", "ge" => ">=", "le" => "<" ); $meta_compare = strtr( $meta_compare, $conversions ); $atts['meta_compare'] = $meta_compare; if ( $meta_compare == "between" ) { $atts = oik_fields_shortcode_atts_between( $atts, $content, $tag ); } } //bw_trace2(); return( $atts ); }View on GitHub
Called by
Calls
1 to 3 of 3
