function get_custom_background_image($post_id = null) { $images = []; // If post id is provided and that post has an image set if ($post_id && current_theme_supports('post-thumbnails') && has_post_thumbnail($post_id)) { // Set the body background image $page_bg_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full'); $images['bg_image_url'] = $page_bg_image[0]; // Set the content image to a custom thumbnail size $page_inner_image = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'inner_image'); $images['inner_image_url'] = $page_inner_image[0]; } else { if (is_school_page() && get_field('event_background_image', 'option')) { $image = get_field('event_background_image', 'option'); // Set the body background image $images['bg_image_url'] = $image["sizes"]["large"]; // Set the content image to a custom thumbnail size $images['inner_image_url'] = $image["sizes"]["large"]; } else { if (is_search() && get_field('search_background_image', 'option')) { $image = get_field('search_background_image', 'option'); // Set the body background image $images['bg_image_url'] = $image["sizes"]["large"]; // Set the content image to a custom thumbnail size $images['inner_image_url'] = $image["sizes"]["large"]; } else { if (!is_front_page()) { $images['bg_image_url'] = get_template_directory_uri() . '/dist/images/home/slide01.jpg'; $images['inner_image_url'] = get_template_directory_uri() . '/dist/images/home/slide01.jpg'; } } } } return $images; }
?> "> </a> <?php } else { ?> <img src="<?php the_field('ad_image', $top_level_parent_id); ?> "> <?php } ?> <?php } elseif (is_school_page()) { ?> <?php if (get_field('events_ad_url', 'option')) { ?> <a href="<?php the_field('events_ad_url', 'option'); ?> " target="_blank"> <img src="<?php the_field('events_ad_image', 'option'); ?> "> </a> <?php