Hooking into PHP functions


show more Hooking into PHP functions provides you with in-depth training on Web. Taught by Joseph Lowery as part of the Dreamweaver and WordPress: Building Sites show less
please wait ...

Hooking into PHP functions

WordPress functions are coded to have what are referred to as hooks, so that they can be easily customized. There are two basic types of hooks: actions and filters, the latter of which we've used repeatedly in our functions.php file so far. Let's take a closer look at the code to create a filter hook first and then add an action hook. As the name suggests, a filter shifts and frequently modifies the data before it's displayed in the browser. I have opened now my functions.php file as you find within the tpa theme folder, and I am going to scroll down.

Here you see two filter hooks. A filter hook has two parts: the function and the add_filter statement. The filter function is often used to define new settings for a built-in function. Let's take a look at the new_excerpt_ length function that we see starting on line 27. This is a pretty basic function that changes the length of the excerpt. By default it's set at 55. With the function new_excerpt_ length, we are changing tha...

Hooking into PHP functions
Video duration: 5m 40s 1h 42m Intermediate

Viewers:

Hooking into PHP functions provides you with in-depth training on Web. Taught by Joseph Lowery as part of the Dreamweaver and WordPress: Building Sites

Subject:
Web
Software:
Dreamweaver WordPress
Author:
please wait ...