string beans_open_markup( string $id, string|bool $tag [, string|array $attributes [, mixed $... ]] );
This function builds the HTML for the specified opening tag’s HTML with the specified attributes (optional) and then returns it back for further processing. It provides flexibility for 3rd party customization (i.e. child theme and/or plugins) to remove or change the HTML.
The power of Beans is the ability to customize whatever you need via the unique ID and internal functionality. Using the specified
$id, a child theme or plugin can register to various events in order to customize. You can:
- Remove the HTML completely.
- Add a new attribute.
- Change an attribute, such as the
- Remove an attribute.
- Add HTML or content before or after the opening tag.
It provides you with the means to customize the default behavior within Beans or your custom child theme or plugin.
- The unique ID for the opening tag, which is used as part of the filter event’s name. This ID can contain sub-hooks.
- The HTML tag to be built for this ID.
- optional The HTML attributes specified as a key/value pair. All valid HTML attributes apply including: class, id, data, itemscope, aria, and more.
- optional Additional argument(s) to be passed to the registered callbacks.
Returns the opening tag’s filtered HTML. If Beans is in “development mode”, the attribute
data-markup-id is added to include the
Available Event Hooks
This function generates the following event hooks, which are available for for third party code to register and customize the HTML:
- Tag filter
$id . '_markup'– to change or remove the tag.
- Before filter
$id . '_before_markup'– to add content before the opening tag.
- Attributes filter
$id . '_attributes'– to remove, add, or change one or more of the attributes.
- After filter for non-self-closing tag
$id . '_prepend_markup'– to add content after the opening tag.
- After filter for self-closing tag
$id . '_after_markup'– to add content after the tag.
Hey... hey you... yes you!... Having a good time? Learning new things? Good!
Show It in Action
More coming soon…keep checking back.
In this section, you will go deeper into the instruction.