The What
Syntax
beans_open_markup_e( string $id, string|bool $tag [, string|array $attributes [, mixed $... ]] );
Description
This function builds and renders the HTML for the specified opening tag’s HTML with the specified attributes (optional). It uses beans_open_markup
and then echoes the return string out to the browser.
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
class
attribute. - 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.
Parameters
id
- The unique ID for the opening tag, which is used as part of the filter event’s name.
tag
- The HTML tag to be built for this ID.
attributes
- 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.
Return Values
Returns the opening tag’s filtered HTML. If Beans is in “development mode”, the attribute data-markup-id
is added to include the $id
.
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.
Once upon a time, there was a developer... You! This is going to be a good story...
Refer to beans_open_markup
for more information, practical use cases, and more.