Front End Developer

Hi,

I need help with the code below. The problem with the code right now is that the options in the select-field only outputs the first letter of each choice. I have setup a custom field (checkbox field – accommodation_select) with ACF. What I want:

– The options in the should show the Titles of the field accommodation_select
– The options in the should only display the selected options
– The value of the options should be passed as parameter to the bookingpage ($form)


<?php $accommodation_type = '';

// If the current page has a setting for type of accommodation, get the value
// If value exists, set it as parameter on the form action to use in the booking page
if (get_field(‘accommodation_select’)) {
$accommodation_type = get_field(‘accommodation_select’);
}

if ($resort_booking_slug) { // If on a resort page or subpage
$form .= ”;
$form .= ‘‘;
$form .= ”;
$form .= ”. __(‘Välj boendetyp’, ‘nordic-camping’) .”;

foreach ($accommodation_type as $accommodation_type) {
if ($current_page_parent_title === $accommodation_type[‘accommodation_select’]) {
$form .= ”. $accommodation_type[‘accommodation_select’] .”;
} else {
$form .= ”. $accommodation_type[‘accommodation_select’] .”;
}
}
$form .= ”;
$form .= ”;
}

$form .= ”. $button_text .”;
$form .= ”;

return $form;

I’ll provide you with more information.

Best,
Rebecca

Company
Rebecca Blakstad Bergström
Job Type
Project
Location
Sweden
Budget
20 EUR
How to Apply
Via email