Created
October 2, 2012 20:24
-
-
Save plasticmind/3823053 to your computer and use it in GitHub Desktop.
Inject class into $before_widget variable
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
// Let's inject a little class into our $before_widget variable | |
if( strpos($before_widget, 'class') === false ) { // It has no class... let's add it! | |
$before_widget = str_replace('>', ' class="custom-class-name">', $before_widget); | |
} else { // We have class... let's append it! | |
$before_widget = str_replace('class="', 'class="custom-class-name ', $before_widget); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment