WordPress shortcode are very useful function that helps lot of us. its similar to shortcuts , its been introduced since WordPress 2.5 They’re hooks which allow you to call a php function simply by typing something like [shortcode]. It is a great way to save time on repetitive tasks
To create a shortcode, you first have to create a php function and then you need to add it to your functions.php
We will be writing a basic function here :
function myfunction() { return 'I m learning now How to create a Shortcode in WordPress at <a href="http://wpden.net">WordPress Den</a>'; }
Once you are done with function, you need to use add_shortcode() function. Paste this code in your functions.php :
add_shortcode('wpden', 'myfunction');
as you can clearly see above wpden is my Shortcode for the function of myfunction
Now you can use the Shortcode were everyou want in your post or page (In HTML Editor):
[wpden]
The Above Shortcode will give the result :
I m learning now How to create a Shortcode in WordPress at WordPress Den