Skip to content

Instantly share code, notes, and snippets.

@lepittenger
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lepittenger/ff902c20a7d02de233de to your computer and use it in GitHub Desktop.
Save lepittenger/ff902c20a7d02de233de to your computer and use it in GitHub Desktop.
Creating a Button Shortcode
How to use
[button link='http://linktosomething.com' color='orange']My Button Text![/button]
function mytheme_button($atts, $content = null) {
$atts = shortcode_atts(array('link' => '#', 'color' => ''), $atts);
return '<a class="button ' . $color . '" href="' . $link . '">' . do_shortcode($content) . '</a>';
}
add_shortcode('button', 'mytheme_button');
@JPry
Copy link

JPry commented Mar 10, 2015

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