Skip to content

Instantly share code, notes, and snippets.

@jongamble
Created March 26, 2014 18:26
Show Gist options
  • Save jongamble/9789972 to your computer and use it in GitHub Desktop.
Save jongamble/9789972 to your computer and use it in GitHub Desktop.
Wordpress custom button shortcode
/*******
* Shortcode for buttons
*******/
function cta_button_func( $atts, $content = null ) {
extract( shortcode_atts( array(
'href' => 'http://10.6.11.245/barrettlawoffices.com/',
'size' => 'text',
), $atts ) );
switch($atts['size']){
case 'text':
$button_size = 'tx';
break;
case 'small':
$button_size = 'sm';
break;
case 'large':
$button_size = 'lg';
break;
default:
$button_size = 'tx';
break;
}
return '<a href="'.$atts['href'].'" class="cta-button-'.$button_size.'">'.$content.'</a>';
}
add_shortcode( 'cta_button', 'cta_button_func' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment