I inherited a WordPress site from another developer. He has a tabbed theme options page. The admin can select to have a modal pop up with a message. You can select which pages you want it to appear on. But right now it’s only working on the page that is first in the selected list:
So in this case, Home is the only place it’s appearing. The ACF field type is relationship, and it was supposedly working for awhile.
Here’s the json:
{
"key": "field_611e74a659c53",
"label": "Specials Modal",
"name": "",
"type": "tab",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"placement": "top",
"endpoint": 0
},
{
"key": "field_611e74b659c54",
"label": "Show/Hide",
"name": "toggle_sm",
"type": "true_false",
"instructions": "Show or Hide the Button and Modal. By default it's hidden.",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "",
"default_value": 0,
"ui": 1,
"ui_on_text": "Show",
"ui_off_text": "Hide"
},
Does anyone have any idea why the modal is only appearing for the first page in the list?
Here’s the php:
$display_ids = get_field('the_display_ids', 'options');
$id = get_the_ID();
?>
@if ($display_ids != null)
@if (get_field('toggle_sm', 'options') && in_array($id, $display_ids) === true)
@include('specials-modal')
@endif
@endif