Hello Friends,
Short code is just a piece of code like ['name'] that execute a complete function in your post or page
Here we have a basic example of shotcode development. Please follow the below example:
1) Open function.php in your theme folder and add your function as below:
/**
* Short code example
*/
function name_func($arr){
return "My name is".$arr['name'].' and I am a '.$arr['designation'];
}
add_shortcode( 'myintro', 'name_func' );
2) Now open your page/post where you want to implement this shortcode
[myintro name="Vivek Rastogi" designation="Software Programmer"] //name and designation are the attribute we pass on like we pass in function
0 Comment(s)