Skip to content

Instantly share code, notes, and snippets.

@michaeljs1990
Last active December 21, 2015 06:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save michaeljs1990/6265916 to your computer and use it in GitHub Desktop.
Shortcode Example
<?php //always use <?php because <? will be depricated in php 6.0
// [defaultButton text="My Button"]
// This would display the bootstrap button with the text My Button inside it.
function bootstrapDefaultBTN( $atts ) {
extract( shortcode_atts( array(
'text' => 'Button',
), $atts ) );
//Button created using bootstrap class that is already pulled in through our theme.
$bootstrapBTN = "<button type='button' class='btn'>" . $text . "</button>"
return $bootstrapBTN;
}
//Shortcode for default bootstrap 2.3 Button
add_shortcode( 'defaultButton', 'bootstrapDefaultBTN' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment