Skip to content

Instantly share code, notes, and snippets.

@r4hulp
Last active December 11, 2018 06:46
Show Gist options
  • Save r4hulp/aebd177a82bbbc59a4ec25e7eb50ca0e to your computer and use it in GitHub Desktop.
Save r4hulp/aebd177a82bbbc59a4ec25e7eb50ca0e to your computer and use it in GitHub Desktop.
WP Shortcodes
.button_style{
display: inline-block;
font-size: 11px;
height: 19px;
margin: 5px 10px 5px 10px;
padding: 9px 13px 0;
text-decoration: none !important;
color:#fff !important;
line-height:11px;
background: #59595a;
border-radius: 3px;
border:1px solid #23282F;
}
/* You can add other sub classes such as small, very large as well. */
.button_style.large{
font-size: 14px;
height: 24px;
line-height: 14px;
padding: 11px 10px 0;
background-position:0 -28px;
}
.button_style{
text-shadow:0 1px 0 rgba(0, 0, 0, 0.4) !important;
-webkit-transition:all 0.3s ease-in;
-moz-transition:all 0.3s ease-in;
-o-transition:all 0.3s ease-in;
transition:all 0.3s ease-in;
}
.button_style:hover{
text-decoration:none !important;
opacity:0.8;
}
.blue{
background: #0276c1 !important;
color:#fff !important;
text-shadow:0 -1px 0 #888 !important;
border:1px solid #005c97 !important;
}
.green{
background: #8ebd40 !important;
color:#fff !important;
text-shadow:0 -1px 0 #888 !important;
border:1px solid #7ca932 !important;
}
[button link=" <link here> " target= " " theme = " theme class name" align = " Left or right" size = "button size"] Button Name [/button]
function button( $atts, $content = null ) {
extract(shortcode_atts(array(
'link' => '#',
'target' => '',
'theme' => '',
'size' => '',
'align' => '',
), $atts));
$style = ($theme) ? ' '.$theme: '';
$align = ($align) ? ' align'.$align : '';
$size = ($size == 'large') ? ' large_button' : '';
$target = ($target == 'blank') ? ' target="_blank"' : '';
$out = '<a' .$target. ' href="' .$link. '">' .do_shortcode($content). '</a>';
return $out;
}
add_shortcode('button', 'button');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment