• Hello, I am using the following code

    add_action( 'wccpf/before/field/start', 'wccpf_field_wrapper_start' );
    function wccpf_field_wrapper_start( $field ) {
        var_dump($field);
        /* Individual wrapper element start */
        echo '<div class="your-custom-field-wrapper-class">';
        /* You can even test for any specific field and add your own elements elements accordingly  */
        if( $field["type"] == "file" ) {
            echo '<h5>Please upload images with size of less than 1MB</h5>';
        }
    }
     
    add_action( 'wccpf/after/field/end', 'wccpf_field_wrapper_end' );
    function wccpf_field_wrapper_end(  $field ) {
        /* Individual wrapper element end */
        echo '</div>';
    }

    I added the code above in my functions.php file in my theme.

    I found this code here https://sarkware.com/wc-fields-factory-api/

    But it doesnt seem to work. what am i doing wrong?

    • This topic was modified 7 years, 2 months ago by christos312.
Viewing 1 replies (of 1 total)
  • Plugin Author Saravana Kumar K

    (@mycholan)

    From version 2.0.0 I have replaced / with _ on all Wc Fields Factory related actions and filters. (It’s on the release note).

    So

    add_action( 'wccpf/before/field/start', 'wccpf_field_wrapper_start' );

    has to be like this

    add_action( 'wccpf_before_field_start', 'wccpf_field_wrapper_start' );

Viewing 1 replies (of 1 total)
  • The topic ‘function.php add_action does not work’ is closed to new replies.