Support

Account

Home Forums Front-end Issues HTML form rendering in acf-field-functions.php

Solving

HTML form rendering in acf-field-functions.php

  • Within the this file of your (pro) plugin:

    advanced-custom-fields-pro/includes/acf-field-functions.php

    on rows 733 – 751 the fields HTML is rendered:

    	// Render HTML
    	echo "<$element $attributes_html>" . "\n";
    		if( $element !== 'td' ) {
    			echo "<$inner_element class=\"acf-label\">" . "\n";
    				acf_render_field_label( $field );
    				if( $instruction == 'label' ) {
    					acf_render_field_instructions( $field );
    				}
    			echo "</$inner_element>" . "\n";
    		}
    		echo "<$inner_element class=\"acf-input\">" . "\n";
    			acf_render_field( $field );
    			if( $instruction == 'field' ) {
    				acf_render_field_instructions( $field );
    			}
    		echo "</$inner_element>" . "\n";
    	echo "</$element>" . "\n";

    Is it possible to change the class acf-label to uk-form-label and the class acf-input to uk-form-controls?

    Maybe adding some code to my functions.php or maybe a code to replace the whole file or something?

    I really really need this change to implement the UIKIT frontend framework…

    Fingeres crossed….

    PS. Or is there a way to completely overwrite the following function:

    function acf_render_field_wrap( $field, $element = 'div', $instruction = 'label' ) {

  • Or even just ADDING these classes would also do the trick….

  • There isn’t any way to alter the classes on the field and label elements. Doing so would require writing custom JavaScript. https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.