Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@salcode
Forked from lepittenger/README.txt
Created March 10, 2015 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salcode/597ae93ac8e85f343570 to your computer and use it in GitHub Desktop.
Save salcode/597ae93ac8e85f343570 to your computer and use it in GitHub Desktop.
How to use
[button link='http://linktosomething.com' color='orange']My Button Text![/button]
<?php
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');
@salcode
Copy link
Author

salcode commented Mar 10, 2015

I've removed the extract() function, which is a recent best practice generally agreed upon in WordPress.
See https://core.trac.wordpress.org/ticket/22400

@lepittenger
Copy link

Thanks Sal

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