Successfully reported this slideshow.
Your SlideShare is downloading. ×

Creating a button shortcode

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 9 Ad

Creating a button shortcode

Download to read offline

In this presentation, I discuss a use case for a WordPress button shortcode & how to make one.

In this presentation, I discuss a use case for a WordPress button shortcode & how to make one.

Advertisement
Advertisement

More Related Content

Advertisement
Advertisement

Creating a button shortcode

  1. 1. Creating a Button Shortcode @laurenpittenger Slides: bit.ly/burbswpbuttonshortcode
  2. 2. What We Needed
  3. 3. What Didn’t Work So Well
  4. 4. What Didn’t Work So Well
  5. 5. What Didn’t Work So Well
  6. 6. 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
  7. 7. 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]
  8. 8. Final Result
  9. 9. Future Improvements

×