Skip to content

Instantly share code, notes, and snippets.

@Pleiades
Created November 15, 2012 19:08
Show Gist options
  • Save Pleiades/4080541 to your computer and use it in GitHub Desktop.
Save Pleiades/4080541 to your computer and use it in GitHub Desktop.
WordPress Shortcode to Add a Big Orange Button With a Link
.orange-button {
background: none repeat scroll 0 0 #FB661B;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
display: table;
margin: 10px auto;
padding: 3px 10px;
text-align: center;
}
.orange-button a,
.orange-button a:hover,
.orange-button a:visited {
color: #fff;
}
function orange_button($atts, $content = null) {
extract(shortcode_atts(array(
'link' => 'http://handsonwordpress.com'
), $atts));
return '<a class="orange-button" href="'.$link.'">' . $content . '</a>';
}
add_shortcode('button', 'orange_button');
Example of the use of this shortcode that uses the default link:
[button]Learn About Shortcodes[/button]
Using the shortcode with a specified link:
[button link="http://handsonwordpress.com/classes/wordpress-advanced/"]Learn About Shortcodes[/button]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment