Created
January 27, 2015 09:21
-
-
Save slifin/2cd91a8b22f26cff6ea6 to your computer and use it in GitHub Desktop.
button shortcode
This file contains 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
/*===========================================================*/ | |
/* Button | |
/*===========================================================*/ | |
if ( !function_exists('sdesigns_button') ) { | |
function sdesigns_button( $atts, $content = null ) { | |
$defaults = array( | |
'to' => '#', | |
'type' => 'normal' | |
); | |
extract( shortcode_atts( $defaults, $atts ) ); | |
if ( $type == 'read' ) { | |
return '<button class="button read-book-button" data-open="book-1">'. do_shortcode($content) .'</button>'; | |
} else if ( $type = 'dotted' ) { | |
return '<a href="' . $to . '" class="button dotted-button">'. do_shortcode($content) .'</a>'; | |
} else { | |
return '<a href="' . $to . '" class="button">'. do_shortcode($content) .'</a>'; | |
} | |
} | |
add_shortcode( 'button', 'sdesigns_button' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment