I need help with WordPress. I've created custom field called: Select number of workers
. And here is select list from 1 to 10;
Now, there is a part where I need help. Is it possible to make as many input fields as the selected number? For example I select 3 workers. And WordPress creates 3 input fields, to type workers name? WordPress is new to me so I don't have much experience in this.
I suggest if you're not really comfortable with Wordpress to use a custom fields plugin like Advanced Custom Fields or Custom Fields Suite. With Custom Fields Suite for example, you can create a loop of fields, set is maximum to 10 then user can add as much worker as they want up to ten.
Then in the template, you can get the content in this way:
$fields = CFS()->get( 'workers' );
foreach ( $fields as $field ) {
echo $field['name'];
}