Skip to content

Instantly share code, notes, and snippets.



Created Jul 1, 2013
What would you like to do?
Create a div shortcode - so you can wrap content in a div in the WordPress editor. Usage: [div id="ID" class="CLASS"]xxxx[/div]
# For Functions.php
// DIV SHORTCODE. Usage: [div id="ID" class="CLASS"]xxxx[/div]
function createDiv($atts, $content = null) {
'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