function xt_body_class_names($classes) { global $post; $main_layout = xt_option('main-layout'); $enable_nice_scroll = (bool) xt_option('enable_nice_scroll'); $enable_smooth_scroll = (bool) xt_option('enable_smooth_scroll'); $hide_admin_bar = (bool) xt_option('hide_admin_bar'); if (!$hide_admin_bar && is_user_logged_in()) { $admin_bar_position = xt_option('admin_bar_position'); $classes[] = "admin-bar-" . esc_attr($admin_bar_position); } if (is_page_template('tpl-endless-posts.php')) { $classes[] = 'tpl-endless-articles'; $classes[] = 'no-padding'; } else { if (is_singular('post') && !empty($post->ID)) { list($single_post_featured_image, $single_post_featured_image_position) = xt_get_featured_image_settings($post->ID); if ($single_post_featured_image_position == 'behind-title-fullwidth') { $classes[] = 'no-padding'; } } } if ($enable_nice_scroll) { $classes[] = 'nice-scroll-enabled'; } if ($enable_smooth_scroll) { $classes[] = 'smooth-scroll-enabled'; } if (!empty($main_layout)) { $classes[] = 'layout-' . $main_layout; } if (!empty($post)) { if (strpos($post->post_content, 'vc_row') !== false) { $classes[] = 'has-wpb-js-composer'; } } return $classes; }
function xt_single_post_image($withTitle = false, $asBackground = false) { global $post; $post_id = get_the_ID(); if (!has_post_thumbnail($post_id)) { return false; } list($single_post_featured_image, $single_post_featured_image_position) = xt_get_featured_image_settings($post_id); if ($single_post_featured_image != 'none') { $is_endless_template = xt_is_endless_template(); $featured_image_crop_height = (int) get_field('single_post_featured_image_crop'); if ($asBackground && empty($featured_image_crop_height)) { $featured_image_crop_height = 600; } $image_size = 'th-xlarge'; if ($is_endless_template) { $image_size = 'th-large'; $featured_image_crop_height = false; } if (!empty($featured_image_crop_height)) { $image = get_post(get_post_thumbnail_id($post_id, $image_size)); $image_width = XT_Theme::$image_sizes[$image_size]['width']; $image_url = $image->guid; if ($single_post_featured_image != 'fullwidth') { $image_width = null; } $resized_image = aq_resize($image_url, $image_width, $featured_image_crop_height, true, false, true); if (!$asBackground && $resized_image !== false) { $featured_image = '<img itemprop="image" alt="' . esc_attr($image->post_title) . '" src="' . esc_url($resized_image[0]) . '" width="' . esc_attr($resized_image[1]) . '" height="' . esc_attr($resized_image[2]) . '" class="wp-post-image wp-featured-image ' . esc_attr($single_post_featured_image) . '">'; } else { if ($asBackground && $resized_image !== false) { $featured_image = '<div itemprop="image" content="' . esc_url($resized_image[0]) . '" class="featured-background ' . esc_attr($single_post_featured_image) . '" style="background-image:url(' . esc_url($resized_image[0]) . '); height:' . $resized_image[2] . 'px">'; } } } else { if (!$asBackground) { $featured_image = get_the_post_thumbnail($post_id, $image_size, array('itemprop' => 'image', 'class' => 'wp-featured-image ' . esc_attr($single_post_featured_image))); } } if ($featured_image !== false) { if (!$asBackground) { echo '<div class="th ' . esc_attr($single_post_featured_image) . '">'; } echo $featured_image; if ($withTitle) { ?> <div class="featured-image-behind-title-wrap gradient-wrap"> <div class="vc_row in-container l-padding-10 r-padding-10"> <?php xt_post_title('h1'); ?> </div> </div> <?php } echo '</div>'; } } }
<?php global $post, $sidebar_below_title, $is_endless_template; $post_format = get_post_format(); $is_endless_template = xt_is_endless_template(); $sidebar_below_title = xt_is_sidebar_below_title($post->ID); //Featured image settings list($single_post_featured_image, $single_post_featured_image_position) = xt_get_featured_image_settings($post->ID); $behind_title_fw = $single_post_featured_image_position == 'behind-title-fullwidth'; if ($behind_title_fw && !$sidebar_below_title) { $sidebar_below_title = true; } // Post settings $post_settings = xt_get_single_settings('post'); extract($post_settings); // Smart Sidebar $smart_sidebar_position = xt_smart_sidebar_position(); $smart_sidebar_enabled = $smart_sidebar_position !== false; ?> <!--Single Article --> <article id="post-<?php the_ID(); ?> " data-postid="<?php echo esc_attr($post->ID); ?> " data-guid="<?php echo esc_attr(get_the_guid($post->ID)); ?>