GetSimple Support Forum

Full Version: What is a filter / What is a hook ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.
Hi Shawn_a

OK, thanks for that

Aldebaran