beans_add_attribute

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

NameTypeRequiredDefaultDescription
$idstringtrue-The markup ID.
$attributestringtrue-Name of the HTML attribute.
$valuestringtrue-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' );

}