Skip to content

Instantly share code, notes, and snippets.

@Rubel-hossain
Created February 8, 2015 17:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rubel-hossain/5789ff023fee863d8d71 to your computer and use it in GitHub Desktop.
Save Rubel-hossain/5789ff023fee863d8d71 to your computer and use it in GitHub Desktop.
Ideal Shortcode example
<?php
function button_shortcode($atts,$content){
extract($atts=shortcode_atts(array(
'type'=>!empty($type) ? $type:'success',
'link'=>'http://www.m.facebook.com',
'icon'=> empty($icon) ? 'heart': $icon ,
'content'=> !empty($content) ? $content : 'empty content here'
),$atts,'btn'));
return '<a href="'.$link.'" class="btn btn-'.$type.'"><i class="fa fa-'.$icon.' "></i> '.$content.' </a>';
}
add_shortcode('btn','button_shortcode');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment