Created
July 1, 2013 11:51
-
-
Save NeilJS/5900183 to your computer and use it in GitHub Desktop.
Create a div shortcode - so you can wrap content in a div in the WordPress editor.
Usage: [div id="ID" class="CLASS"]xxxx[/div]
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
# For Functions.php | |
// DIV SHORTCODE. Usage: [div id="ID" class="CLASS"]xxxx[/div] | |
function createDiv($atts, $content = null) { | |
extract(shortcode_atts(array( | |
'id' => "", | |
'class' => "", | |
), $atts)); | |
return '<div id="'. $id . '" class="'. $class . '" />' . $content . '</div>'; | |
} | |
add_shortcode('div', 'createDiv'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment