I have an shortcode that i would like it to pass an different class once a certain attribute is added to the shortcode. How do you do that? or what is the best way to do this?
Shortcode:
function one_half_columns($atts, $content = null){
$type = shortcode_atts( array(
'default' => 'col-md-6',
'push' => 'col-xs-6'
), $atts );
return '<div class="' . $type['push'] . '">' . do_shortcode($content) . '</div>';;
}
add_shortcode('one_half', 'one_half_columns');
Example when wordpress user enter [one_half type="push"]
i want it to use the value of push
in array col-xs-6
.