Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create shortcode in Wordpress

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 139
    Comment on it

    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:

    1. /**
    2. * Short code example
    3. */
    4. function name_func($arr){
    5. return "My name is".$arr['name'].' and I am a '.$arr['designation'];
    6. }
    7. add_shortcode( 'myintro', 'name_func' );

    2) Now open your page/post where you want to implement this shortcode

    1. [myintro name="Vivek Rastogi" designation="Software Programmer"] //name and designation are the attribute we pass on like we pass in function

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: