beans_replace_attribute

Replace 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_replace_attribute( string $id, string $attribute, string $value, string $new_value = null )

Return: (array) All targeted markup attributes.

Parameters

NameTypeRequiredDefaultDescription
$idstringtrue-The markup ID.
$attributestringtrue-Name of the HTML attribute to target.
$valuestringtrue-Value which should be replaced.
$new_valuestringfalsenullReplacement value. 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_replace_attribute( $id, $attribute, $value, $new_value = null ) {

	$class = new _Beans_Attributes( $id, $attribute, $value, $new_value );

	return $class->init( 'replace' );

}