PHP BootStrap Switch

$selectWidth = $column_widths; switch ($selectWidth) { case "six-six": $left_class = "col-md-6"; $right_class = "col-md-6"; break; case "four-eight": $left_class = "col-md-4"; $right_class = "col-md-8"; break; case "five-seven": $left_class = "col-md-5"; $right_class = "col-md-7"; break; case "three-nine": $left_class = "col-md-3"; $right_class = "col-md-9"; break; case "seven-five": $left_class = "col-md-7"; $right_class = "col-md-5"; break; case "eight-four": $left_class = "col-md-8"; $right_class = "col-md-4"; break; case "nine-three": $left_class = "col-md-9"; $right_class = "col-md-3"; break; default: // Nothing to see here. }
For this example I've created a variable that is a select field in ACF. Based on the selected value this is going to add a bootstrap class to a right and left column where is it echoing out the value of $left_class or $right_class.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.