Add attribute to markup.
This function must be called before the targeted markup is called.
The “data-markup-id” is added as a HTML attribute if the development mode is enabled. This makes it very easy to find the content ID when inspecting an element in a web browser.
beans_add_attribute( string $id, string $attribute, string $value )
Return: (array) All targeted markup attributes.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
$id | string | true | - | The markup ID. |
$attribute | string | true | - | Name of the HTML attribute. |
$value | string | true | - | Value of the HTML attribute. If set to '' will display the attribute value as empty (e.g. class=""). Setting it to 'false' will only display the attribute name (e.g. data-example). Setting it to 'null' will not display anything. |
Source
function beans_add_attribute( $id, $attribute, $value ) {
$class = new _Beans_Attributes( $id, $attribute, $value );
return $class->init( 'add' );
}