Created
November 19, 2020 22:58
-
-
Save isotrope/a691ae84fa44351cce6015421729fe7f to your computer and use it in GitHub Desktop.
Hi Josh!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$classes = []; | |
// bunch of code | |
if( some condition) { | |
$classes[] = 'has-thumbs'; | |
} | |
// bunch of code | |
if( .. IDK ... count( $array_bla ) > 4) { | |
$classes[] = 'webmasters-went-cray-cray'; | |
} | |
// to be super super super super safe | |
array_walk($classes, function( $class_name ) { | |
return sanitize_title($class_name); | |
}); | |
?> | |
<div class="container <?php echo implode(' ', $classes); ?>"></div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment