Skip to content

Instantly share code, notes, and snippets.

@shahidulislamus
Created January 26, 2015 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shahidulislamus/b2b5e325019b16ced17c to your computer and use it in GitHub Desktop.
Save shahidulislamus/b2b5e325019b16ced17c to your computer and use it in GitHub Desktop.
//basic concept to create shortcode
function my_shortcode(){
extract(shortcode_atts(array(
'type' => '', //hear "type" is a variable and hear you can put the default value which is work before the daynamic value come
'icon' => '', //hear "icon" is a variable and hear you can put the default value which is work before the daynamic value come
'text' => '', //hear "type" is a variable and hear you can put the default value which is work before the daynamic value come
), $atts));
return'<a href="'.$link.'" class="btn btn-'.$type.'" ><i class="fa fa-'.$icon.'"> </i> '.$text.'</a>'; //this is the return value where you must define the variable
}
add_shortcode('name_of_shortcode','my_shortcode');
//shortcode which is used to call this function
// [name_of_shortcode type="success" icon="facebook" text="this is a button"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment