Skip to content

Instantly share code, notes, and snippets.

Forked from lepittenger/README.txt
Created March 10, 2015 00:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
How to use
[button link='' color='orange']My Button Text![/button]
function mytheme_button($atts, $content = null) {
$atts = shortcode_atts(array('link' => '#', 'color' => '#'), $atts);
return '<a class="button ' . $atts['color'] . '" href="' . $atts['link'] . '">' . do_shortcode($content) . '</a>';
add_shortcode('button', 'mytheme_button');
Copy link

salcode commented Mar 10, 2015

I've removed the extract() function, which is a recent best practice generally agreed upon in WordPress.

Copy link

Thanks Sal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment