WordPress shortcode is a A specific code that lets you do nifty things with very little effort.By creating WordPress shortcode you can avoid to create complicated template because you can use that shortcode in the page content .You can also use this in your template file . I recently needed to create a shortcode in my wordpress and happy to know how simple wordpress makes creating new custom shortcode . Hope it’ll help you .

First you need to create your own function in theme’s function.php or you can create this function in plugin files . Function should return some string value and that value will replace your the shortcode in the view.

function my_firstshortcode() {
	// your logic here
        
         $output="hey! how are you?";
	// return the output
	return $return;
}

Remember that the function should be of return type without echo. Now you can use WordPress function to register your shortcode.

add_shortcode('myshortcode', 'my_firstshortcode');

Now you can use [myshortcode] in your page/post content or in template file

WordPress shortcode also support arguments so you can pass your arguments to the function with $arg which is an array with key=>value pair .Here is an example.

function my_firstshortcode($arg) {
	// your logic here
        //$arg=array('arg1'=>'value1','arg2'=>'value1')
         foreach($arg as $key=>$val)
         {
              // your logic
         }
         $output="hey! how are you?";
	// return the output
	return $return;
}
add_shortcode('myshortcode', 'my_firstshortcode');

you can use the shortcode like [shortcode_name arg1=”value1″ arg2=”value1″]

http://codingbin.com/wp-content/uploads/2015/11/shortcodes.jpghttp://codingbin.com/wp-content/uploads/2015/11/shortcodes-150x150.jpgdevidcmsWordPressplugin,shortcodes,wordpressWordPress shortcode is a A specific code that lets you do nifty things with very little effort.By creating WordPress shortcode you can avoid to create complicated template because you can use that shortcode in the page content .You can also use this in your template file . I recently...coding, php, wordpress, yii, cakephp, and  jquery

Are you want to get implementation help, or modify or extend the functionality of this script? Submit paid service request