Archive for November, 2012

Create your own wordpress hook

Posted: November 26, 2012 in WordPress

Though we developed many themes and plugins we do not own
a single hook which fills our requirement this is for those
who wish to create their own hook for their requirement.

How it works?

Ideally our lovely WordPress provides a brilliant
method to create hook which is do_action(),
this generally refers to create hook,
this method serves as placeholder where add_action() needs
triger the specific event.

How to create action hook?

add_action('Ski_hook_after_title','after_title',10);

function after_title(){
echo “Sandeep Kumar”;
echo “Do your stuff here”;

}

function ski_hook_after_title(){
do_action(‘ski_hook_after_title’);
}