The What
Description
This function provides the means to filter the HTML output before it goes out to the browser. A string output is passed through a filter event, thereby allowing the child theme or plugin(s) to hook into the point of processing and change the output before it is rendered to the browser.
The filter event’s name is the $id
plus a suffix of '_output'
.
If you need to pass additional information to the callbacks, pass those as the 3rd (etc) argument(s).
Parameters
id
- The unique ID for the output, which is used as part of the filter event’s name. This ID can contain sub-hooks.
output
- The string content to be filtered and then returned. It’s the content you want to make available for filtering.
...
- optional Additional argument(s) to be passed to the registered callbacks.
Return Values
Returns the filtered output. If Beans is in “development mode”, HTML comments are wrapped around the filtered output to provide the ID for this rendered output.
Available Event Hooks
This function generates the following event hooks, which are available for for third party code to register and customize the HTML:
- Output filter
$id . '_output'
– to change or remove the output.
Break. Go rest your noodle for a couple of minutes.
Show It in Action
Registering a Callback
In order to filter the output, the child theme or plugin registers a callback to the target ID + _output
. For example, if the ID is 'beans_post_more_link_text'
, then the filter event’s name is 'beans_post_more_link_text_output'
.
-
'Read More' Link Text Example
Go DeepPro
In this section, you will go deeper into the instruction.