Skip to content

Instantly share code, notes, and snippets.

@slifin
Created January 27, 2015 09:21
Show Gist options
  • Save slifin/2cd91a8b22f26cff6ea6 to your computer and use it in GitHub Desktop.
Save slifin/2cd91a8b22f26cff6ea6 to your computer and use it in GitHub Desktop.
button shortcode
/*===========================================================*/
/* 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