Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
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 ...
function mytheme_button ($atts, $content = null) {
$atts = shortcode_atts( array('link' => '', 'color' => ''), $atts);
ret...
Final Result
Future Improvements
Upcoming SlideShare
Loading in …5
×

Creating a button shortcode

255 views

Published on

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

Published in: Technology
  • Be the first to comment

  • Be the first to like this

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

×