Download - Creating a button shortcode
![Page 1: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/1.jpg)
Creating a Button Shortcode@laurenpittenger
Slides:bit.ly/burbswpbuttonshortcode
![Page 2: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/2.jpg)
What We Needed
![Page 3: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/3.jpg)
What Didn’t Work So Well
![Page 4: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/4.jpg)
What Didn’t Work So Well
![Page 5: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/5.jpg)
What Didn’t Work So Well
![Page 6: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/6.jpg)
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
![Page 7: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/7.jpg)
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]
![Page 8: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/8.jpg)
Final Result
![Page 9: Creating a button shortcode](https://reader035.vdocuments.us/reader035/viewer/2022071815/55aa11d81a28ab7d4c8b4590/html5/thumbnails/9.jpg)
Future Improvements