4

How can I make hooks in php. I am not sure on how wordpress process their hooks. This is a short example that I wanted to do.

I have a script tag on my register.php file and I wanted it to move on the **<head>**

I need an example on how to do this. Thanks in advance.

JohnP
  • 49,507
  • 13
  • 108
  • 140
Jorge
  • 5,610
  • 18
  • 47
  • 67
  • Have a look at this manual entry : http://www.php.net/manual/en/ref.funchand.php – JohnP Mar 09 '11 at 12:17
  • For a vague description of plugin hooks: http://stackoverflow.com/questions/5127424/how-does-plugin-system-work-wordpress-mybb/5127470#5127470 - In this case you want the registered callbacks invoked e.g. in the template to output extra content after the ``. – mario Mar 09 '11 at 12:20

2 Answers2

3

Look here: http://components.symfony-project.org/event-dispatcher/

It's a small and powerful hook library with full documentation

Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
1

I think you should take a look at one design pattern called observer pattern.

XuDing
  • 1,982
  • 18
  • 27