creating a button shortcode
TRANSCRIPT
Creating a Button Shortcode@laurenpittenger
Slides:bit.ly/burbswpbuttonshortcode
What We Needed
What Didn’t Work So Well
What Didn’t Work So Well
What Didn’t Work So Well
Shortcode Approach● Shortcode allows the user to create a button
without knowing how to code
● It can be placed anywhere in the content of a post or page as well as in text widgets
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');
The Code
Get the code on GitHub: bit.ly/buttonshortcode
[button link='http://linktosomething.com' color='orange']My Button Text![/button]
Final Result
Future Improvements