camelCase in $atts
-
I’m using cSlider version 2.4.2,
I am using two different sliders on my page, one with default settings and one with changed settings.
I was having a problem with setting attributes in the shortcode,
and it took me almost all morning to figure it out because the logic is solid.But here is what I found:
in cslider.php the shortcode function uses camelCase to declare $atts if the names are compound words
e.g.if($atts["infiniteLoop"]) { $infiniteLoop = $atts["infiniteLoop"]; }
This causes an issue when declaring the attributes in the shortcode and the default settings (or option settings) will be used instead.
When you enter:
[cSlider infiniteLoop='true']
according to the WP Shortcode API, “Attribute names are always converted to lowercase before they are passed into the handler function.”
so the function is getting
$atts['infiniteloop']
but is referencing
$atts['infiniteLoop']
This can be remedied entirely by changing references to $atts to all lowercase both in the shortcode and in the handler function.
Otherwise thanks for making such a handy plugin!
- The topic ‘camelCase in $atts’ is closed to new replies.