WordPress Plugin Shortcode development

A Plugin is trigger whenever a page or post loaded .
A shortcode is the code within a [] braces which will trigger a functionality into front end . When a page or post loaded or requested , plugin manager read the post content and if it found any shortcode which is register for any plugin installed and will trigger the specified functionality .

Shortcode for a plugin is a very important functionality and hook of in a plugin development for display data in front site.

Example Of Shortcode :   [shortcodename attr1=value1 attr2=value2 .......]

WordPress Hook for shortcode :

add_shortcode(“Shortcode”,”callbackfunction “);

 

function callbackfunction ($atts)
{

$value1=trim($atts['attr1']);

include ‘shortcode.php’; // Functionality file if you want to code in separate file
}

 

Make sure used Shortcode name is not using by any of the installed plugin in your wordpress .

 

 

Show Buttons
Hide Buttons