Last active
December 21, 2015 06:39
-
-
Save michaeljs1990/6265916 to your computer and use it in GitHub Desktop.
Shortcode Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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