How do I add additional container tag default options?

The Container Tag setting allows you to modify what HTML tag the field content is wrapped with. Here's what the setting looks like when using DIY Layout:

DIY Layout field settings modal, with the Container Tags setting highlighted with a red rectangle

You can use the  gravityview-diy/container-tags filter to modify the Container Tags shown in the DIY Layout:

add_filter( 'gravityview-diy/container-tags', 'gv_diy_modify_container_tags', 10, 3 );

 * Modify the tags shown in the DIY Layout Field Settings
 * @param array $container_tags HTML tags in "tag name" => "tag label" array
 * @param string $input_type Type of input being displayed ("address", "text", "list", "custom")
 * @param string $context `directory`, `single`, `edit`
function gv_diy_modify_container_tags( $container_tags = array(), $input_type, $context = 'directory' ) {
	// Add a "figure" option
	$container_tags['figure'] = 'Figure';
	// Remove the H4 option
	unset( $container_tags['h4'] );
	return $container_tags;

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us