about 9 years ago
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' );
/** * 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
0 Comment(s)