Skip to content

Instantly share code, notes, and snippets.

@NeilJS
Created July 1, 2013 11:51
Show Gist options
  • Save NeilJS/5900183 to your computer and use it in GitHub Desktop.
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]
# 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