WordPress form plugin only get one field in hook

I downloaded the plugin ninja forms, and I created a form. as PHP code, I got my own plugin, which renders PHP code before each field, using this hook:

http://ninjaforms.com/documentation/developer-api/actions/ninja_forms_display_before_field/

Read More
function test() {
    $output = "hello";
    echo $output;
    return $output;
}

add_action('ninja_forms_display_before_field','test');

Now it looks like:

hello
field
hello
field
hello
field

my Questions:
How can I use this hook, on only one field? I saw the example on the link i have written before – but I don’t really understand how this helps me(new to wordpress).
I probably have to pass some kind of parameter to the hook, but I am not sure how to do this.

Thanks!

Related posts

Leave a Reply

1 comment

  1. I had to create two additional parameters, which I can check with the if-statement:

    function checkFieldId($field_id, $data) {
        //var_dump($field_id);
        if($field_id == 11 ){
            placeholder();
        }
    }
    

    add_action('ninja_forms_display_before_field','checkFieldId', 10, 2);