It’s very tricky to create Shorts codes for any functions created in wordpress. With shortcode we can use the functionally anywhere in the wordpress theme with easy way. Here it’s a function that will tells you how to create the shortcodes in PHP
Function MyShortcode()
{
return ‘<p>Hello World! I Love ShortCodes</p>’;
}
add_shortcode(‘ShortcodeName’, ‘ MyShortcode ‘);
After adding this code in theme function.php file you can add Short code in wordpress pages.
The function add_shortcode pass two parameters’, first is Name of shrotcode and second parameter is Function that we can to call with the shortcode.
To call short code you can use [ShortcodeName] anywhere in the pages and post to call shortcodes.
You must be logged in to post a comment.