Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is a filter / What is a hook ?
#1
Hi All

I am just learning how to add in a very simple plugin to a website, and so I am first reading the Hello World plugin tutorial at : http://get-simple.info/wiki/plugins:creation

In this page there is the following :

Hooks & Filters
This code is what attaches your custom function to a particular hook or filter.
# activate filter
add_action( 'theme-footer', 'hello_world', array() );
Syntax: add_action( 'hook name', 'function to call', Array of Args );

So what does all this mean exactly ? .. what is a filter ? , what is a hook ? , and what does ‘attaches’ mean ? … Are these GetSimple specific terms or general PHP terms ?

I am learning PHP at the same time, so am not fully familiar with php ..

Many Thanks, Aldebaran
Reply
#2
These are basically "callbacks" or rather "callouts"

you give us your function name you want us to execute when x happens.
x being an action

When x happens, we execute "function_name(args)" that you specify.

for filters we execute

$value = function($value);
and we use your return value as the new values, for example modifying stuff like content etc.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
Hi Shawn_a

OK, thanks for that

Aldebaran
Reply




Users browsing this thread: 1 Guest(s)