Add Custom Classes to Add Entry Button

Instructions

Code

Filename: gpnf-add-custom-classes-to-add-entry-button.php

<?php
/**
 * Gravity Perks // Nested Forms // Add Custom Classes to Add Entry Button
 * https://gravitywiz.com/documentation/gravity-forms-nested-forms/
 *
 * Instruction Video: https://www.loom.com/share/bfa19506533a42f98fb22cf5b951dc3a
 *
 */
add_filter( 'gpnf_template_args', function( $args ) {
	if ( $args['template'] === 'nested-entries' ) {
		$append_classes     = 'class-a class-b';
		$args['add_button'] = str_replace( 'gpnf-add-entry', 'gpnf-add-entry ' . $append_classes, $args['add_button'] );
	}
	return $args;
} );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.