function thb_featuredimagebackground() { $image_size = 'large'; if (function_exists('is_woocommerce') && is_shop()) { $image = thb_get_option('woocommerce_shop_pageheader_background_image'); thb_get_template_part('partial-featuredimage-background', array('featured_image' => thb_image_get_size($image['id'], $image_size), 'bg_opacity' => thb_get_option('woocommerce_shop_pageheader_background_opacity'))); } elseif (function_exists('is_woocommerce') && is_product_category()) { global $wp_query; $cat = $wp_query->get_queried_object(); $thumbnail_id = get_woocommerce_term_meta($cat->term_id, 'thumbnail_id', true); thb_get_template_part('partial-featuredimage-background', array('featured_image' => thb_image_get_size($thumbnail_id, $image_size), 'bg_opacity' => thb_get_option('woocommerce_shop_pageheader_background_opacity'))); } else { $page_id = thb_get_page_ID(); $is_dynamic_home = $page_id == 0 && is_front_page() && get_option('show_on_front') == 'posts'; $image = ''; $templates = array('default', 'single.php', 'single-product.php', 'single-works.php', 'template-archives.php', 'template-blog-classic.php', 'template-blog-stream.php', 'template-portfolio.php', 'template-contact.php', 'template-photogallery.php'); if ($page_id !== 0 && !is_singular('works') && !is_attachment()) { $image = thb_get_featured_image($page_id, $image_size); } if (thb_check_page_template($page_id, $templates) || thb_is_archive() || is_attachment()) { thb_get_template_part('partial-featuredimage-background', array('featured_image' => $image, 'bg_opacity' => thb_get_post_meta(thb_get_page_ID(), 'background_opacity'))); } } }
function thb_header_define_page_ID() { global $post; $is_archive = thb_is_archive() || thb_is_blog(); $is_dynamic_home = is_front_page() && get_option('show_on_front') == 'posts'; if ($is_archive || $is_dynamic_home) { $page_id = 0; } else { $page_id = get_the_ID(); } thb_define('THB_THE_ID', $page_id); }