У меня есть настраиваемое поле текстовой области с ключом поля: «спецификации»
https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/
Мне нужна помощь для достижения этой цели.Единственное, что мне нужно, это добавить поле динамического выбора в контактную форму 7 из настраиваемого текстового поля.
, но когда я добавляю фильтр в контактную форму 7, используя https://wordpress.org/plugins/contact-form-7-dynamic-select-extension/
значения поля выборапоказать как один см. изображение
Мне нужно разделить каждый абзац текстового поля на отдельные значения в раскрывающемся списке
, когда я добавляю этот код, значения нет.
$get_custom_posts = explode("\n", $get_custom_posts);
// remove any unwanted white space
$get_custom_posts= array_map('trim', $get_custom_posts);
function cf7_dynamic_select_do_example1($choices, $args=array()) {
$get_custom_posts = get_post_meta( get_the_ID(), 'specifications', false );
// If we have posts, proceed
if ($get_custom_posts) {
// Foreach found custom post, we build the option using the [key] => [value] fashion
foreach ($get_custom_posts as $custom_post) {
$choices[$custom_post] = $custom_post;
}
// If we don't have posts, halt! Lets use a generic not found option
} else {
// Just a generic option to inform nothing was found
$choices['No posts found'] = 'No posts found';
}
return $choices;
}
add_filter('wpcf7_dynamic_select_example1',
'cf7_dynamic_select_do_example1', 10, 2);