creating a button shortcode

9
Creating a Button Shortcode @laurenpittenger Slides: bit.ly/burbswpbuttonshortcode

Upload: lauren-pittenger

Post on 18-Jul-2015

52 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Creating a button shortcode

Creating a Button Shortcode@laurenpittenger

Slides:bit.ly/burbswpbuttonshortcode

Page 2: Creating a button shortcode

What We Needed

Page 3: Creating a button shortcode

What Didn’t Work So Well

Page 4: Creating a button shortcode

What Didn’t Work So Well

Page 5: Creating a button shortcode

What Didn’t Work So Well

Page 6: Creating a button shortcode

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

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

Final Result

Page 9: Creating a button shortcode

Future Improvements