[Plugin: Advanced Custom Fields]Need help with creating new field type with ACF
-
Hello!
I started to use ACF yesterday. I want to create a new field type. I followed the instructions of the official site. But i don’t understand something.
I want my field contain two text-area.
I don’t really know how to do it. So i created a new field, it’s appearing in the edit-page, but i can’t handle the two values. Here is how my create_field function looks like in the php-file of my field (i think thats what i need to change):function create_field( $field ){ ?> <table> <tr> <th scope="col">Year</th> <th scope="col">Text</th> </tr> <tr> <td> <?php echo '<textarea id="' . $field['id'] . 'year" class="' . $field['class'] . '" name="' . $field['name'] . 'year" >' . $field['value']['year'] . '</textarea>'; ?> </td> <td> <?php echo '<textarea id="' . $field['id'] . 'text" class="' . $field['class'] . '" name="' . $field['name'] . 'text" >' . $field['value']['text'] . '</textarea>'; ?> </td> </tr> </table> <?php }
Now, ACF always save the value of the second text-area. What i don’t understand, is how ACF know to save that? And how can i save the value of the first too?
I’m also interested in tutorials if you can suggest me anything in this field.
I tried to find more field-types in the internet (more than the built in ones), but i didn’t found anything.Thanks for your help:
Koli
- The topic ‘[Plugin: Advanced Custom Fields]Need help with creating new field type with ACF’ is closed to new replies.