HEX
Server: nginx/1.18.0
System: Linux vcwordpress 5.15.0-174-generic #184-Ubuntu SMP Fri Mar 13 18:41:50 UTC 2026 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/viitorx.stgviitor.com/wp-content/themes/viitorx/single-case_study.php
<?php

get_header();

while (have_posts()) :
	the_post();

	$post_id         = get_the_ID();
	$gallery_1       = get_post_meta($post_id, 'cs_gallery_1', true);
	$gallery_2       = get_post_meta($post_id, 'cs_gallery_2', true);
	$wide_media      = get_post_meta($post_id, 'cs_media_wide', true);
	$subtitle        = get_post_meta($post_id, 'cs_subtitle', true);
	if ('' === $subtitle) {
		$subtitle = get_the_excerpt();
	}

	$overview       = function_exists('get_field') ? get_field('project_overview') : null;
	$content_rows   = function_exists('get_field') ? get_field('project_content') : null;
	$why_nia         = function_exists('get_field') ? get_field('why_nia') : null;
	$add_video_field = function_exists('get_field') ? get_field('add_video') : null;
	$testimonial     = function_exists('get_field') ? get_field('testimonial') : null;
	$results_acf     = function_exists('get_field') ? get_field('results') : null;
	$conclusion_acf  = function_exists('get_field') ? get_field('conclusion') : null;
	$case_study_hero = function_exists('get_field') ? get_field('case_study_hero') : null;
	$add_video_url   = $add_video_field ? viitorx_acf_file_url($add_video_field) : '';

	$hero_meta = array();
	if (is_array($case_study_hero)) {
		foreach ($case_study_hero as $hero_row) {
			if (! is_array($hero_row)) {
				continue;
			}
			$meta_label = isset($hero_row['title']) ? trim((string) $hero_row['title']) : '';
			$meta_value = isset($hero_row['description']) ? trim((string) $hero_row['description']) : '';
			if ('' === $meta_label && '' === $meta_value) {
				continue;
			}
			$hero_meta[] = array(
				'label' => $meta_label,
				'value' => $meta_value,
			);
		}
	}

	$has_overview   = is_array($overview) && (! empty($overview['title']) || ! empty($overview['description']) || ! empty($overview['images']));
	$has_rows       = ! empty($content_rows) && is_array($content_rows);
	$has_why        = is_array($why_nia) && (! empty($why_nia['title']) || ! empty($why_nia['description']));
	$has_video      = (bool) $add_video_url;
	$has_testimonial = is_array($testimonial) && (! empty($testimonial['quote']) || ! empty($testimonial['designation']) || ! empty($testimonial['brief']));
	$has_results     = is_array($results_acf) && (
		! empty($results_acf['title'])
		|| ! empty($results_acf['description'])
		|| (! empty($results_acf['add_key_points']) && is_array($results_acf['add_key_points']))
	);
	$has_conclusion = is_array($conclusion_acf) && (! empty($conclusion_acf['title']) || ! empty($conclusion_acf['description']));
	$acf_shell      = $has_overview || $has_rows || $has_why || $has_video || $has_testimonial || $has_results || $has_conclusion;

	$overview_images = array();
	if ($has_overview && ! empty($overview['images']) && is_array($overview['images'])) {
		foreach ($overview['images'] as $img_row) {
			if (! is_array($img_row)) {
				continue;
			}
			$url = viitorx_acf_image_url($img_row['upload'] ?? null);
			if ($url) {
				$overview_images[] = $url;
			}
		}
	}

	$hero_media_url = '';
	if (has_post_thumbnail()) {
		$hero_media_url = get_the_post_thumbnail_url($post_id, 'full');
	} elseif (! empty($overview_images[0])) {
		$hero_media_url = $overview_images[0];
	}

	$archive_link = get_post_type_archive_link('case_study');
?>

	<div class="single-case-study">
		<main id="primary" class="site-main page">

			<section class="hero section-reveal--visible" aria-label="<?php esc_attr_e('Case study hero', 'viitorx'); ?>" data-section-reveal>
				<?php get_template_part('template-parts/hero-wordmark'); ?>
				<div class="container hero__inner">
					<div class="hero__top">
						<nav class="hero-breadcrumb" aria-label="<?php esc_attr_e('Breadcrumb', 'viitorx'); ?>">
							<a href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('Home', 'viitorx'); ?></a>
							<span class="hero-breadcrumb__sep" aria-hidden="true">&gt;</span>
							<?php if ($archive_link) : ?>
								<a href="<?php echo esc_url($archive_link); ?>"><?php esc_html_e('Work', 'viitorx'); ?></a>
							<?php else : ?>
								<span><?php esc_html_e('Work', 'viitorx'); ?></span>
							<?php endif; ?>
							<span class="hero-breadcrumb__sep" aria-hidden="true">&gt;</span>
							<span class="hero-breadcrumb__current"><?php echo esc_html(get_the_title()); ?></span>
						</nav>
						<h1 class="hero__title"><?php the_title(); ?></h1>
						<?php if ($subtitle) : ?>
							<p class="hero__subtitle"><?php echo esc_html($subtitle); ?></p>
						<?php endif; ?>
					</div>

					<?php if (! empty($hero_meta)) : ?>
						<dl class="hero__meta" aria-label="<?php esc_attr_e('Project meta', 'viitorx'); ?>">
							<?php foreach ($hero_meta as $mi => $meta) : ?>
								<?php if ($mi > 0) : ?>
									<div class="hero__meta-sep" aria-hidden="true"></div>
								<?php endif; ?>
								<div class="hero__meta-item">
									<dt class="hero__meta-label"><?php echo esc_html($meta['label']); ?></dt>
									<dd class="hero__meta-value"><?php echo esc_html($meta['value']); ?></dd>
								</div>
							<?php endforeach; ?>
						</dl>
					<?php endif; ?>
				</div>
			</section>

			<?php if ($hero_media_url) : ?>
				<section class="hero-media case-study-hero-media" aria-label="<?php esc_attr_e('Project hero image', 'viitorx'); ?>" data-section-reveal>
					<div class="hero-media__img case-study-hero-media__img">
						<img
							src="<?php echo esc_url($hero_media_url); ?>"
							alt="<?php echo esc_attr(get_the_title()); ?>"
							loading="eager"
							fetchpriority="high"
							decoding="async"
							class="case-study-hero-media__img-el"
						/>
					</div>
				</section>
			<?php endif; ?>

			<?php if ($acf_shell) : ?>

				<?php if ($has_overview) : ?>
					<div class="section-divider" aria-hidden="true"></div>
					<section class="content-section" aria-label="<?php esc_attr_e('Project overview', 'viitorx'); ?>" data-section-reveal>
						<div class="container content-section__inner">
							<?php if (! empty($overview['title'])) : ?>
								<h2 class="content-section__title"><?php echo esc_html($overview['title']); ?></h2>
							<?php endif; ?>
							<?php if (! empty($overview['description'])) : ?>
								<div class="content-section__body">
									<div class="text-body case-study-rich"><?php echo wp_kses_post($overview['description']); ?></div>
								</div>
							<?php endif; ?>
						</div>
					</section>

					<?php if (count($overview_images) > 0) : ?>
						<section class="gallery case-study-gallery-dynamic" aria-label="<?php esc_attr_e('Project gallery', 'viitorx'); ?>" data-section-reveal>
							<div class="container">
								<div class="gallery__grid">
									<?php foreach ($overview_images as $idx => $gurl) : ?>
										<div class="gallery__item gallery__item--dynamic<?php echo 0 === $idx ? ' gallery__item--left' : ''; ?><?php echo 1 === $idx ? ' gallery__item--right' : ''; ?>">
											<img src="<?php echo esc_url($gurl); ?>" alt="" loading="lazy" decoding="async" class="gallery__img">
										</div>
									<?php endforeach; ?>
								</div>
							</div>
						</section>
					<?php endif; ?>

				<?php endif; ?>

				<?php if ($has_rows) : ?>
					<?php foreach ($content_rows as $row) : ?>
						<?php if (! is_array($row)) {
							continue;
						} ?>
						<div class="section-divider" aria-hidden="true"></div>
						<section class="content-section" data-section-reveal>
							<div class="container content-section__inner">
								<?php if (! empty($row['title'])) : ?>
									<h2 class="content-section__title"><?php echo esc_html($row['title']); ?></h2>
								<?php endif; ?>
								<div class="content-section__body">
									<?php if (! empty($row['description'])) : ?>
										<div class="text-intro case-study-rich"><?php echo wp_kses_post($row['description']); ?></div>
									<?php endif; ?>

									<?php
									$key_choice = isset($row['add_key_points']) ? $row['add_key_points'] : '';
									$show_pts   = in_array(strtolower((string) $key_choice), array('yes', '1', 'true'), true);
									if ($show_pts && ! empty($row['add_points']) && is_array($row['add_points'])) :
									?>
										<ul class="bullets" aria-label="<?php esc_attr_e('Key points', 'viitorx'); ?>">
											<?php foreach ($row['add_points'] as $pt) : ?>
												<?php if (! is_array($pt)) {
													continue;
												} ?>
												<li class="bullets__item">
													<?php if (! empty($pt['title'])) : ?>
														<strong><?php echo esc_html($pt['title']); ?></strong>
														<?php if (! empty($pt['description'])) : ?>
															<span class="bullets__desc"><?php echo wp_kses_post($pt['description']); ?></span>
														<?php endif; ?>
													<?php elseif (! empty($pt['description'])) : ?>
														<?php echo wp_kses_post($pt['description']); ?>
													<?php endif; ?>
												</li>
											<?php endforeach; ?>
										</ul>
									<?php endif; ?>
								</div>
							</div>
						</section>

					<?php endforeach; ?>
				<?php endif; ?>

				<?php if ($has_video) : ?>
					<?php
					$vid_mime = '';
					if (is_array($add_video_field) && ! empty($add_video_field['mime_type'])) {
						$vid_mime = $add_video_field['mime_type'];
					}
					$vid_att_id = is_array($add_video_field) && isset($add_video_field['ID'])
						? (int) $add_video_field['ID']
						: (is_numeric($add_video_field) ? (int) $add_video_field : 0);
					if (! $vid_mime && $vid_att_id) {
						$vid_mime = get_post_mime_type($vid_att_id);
					}
					if (! $vid_mime) {
						$path = wp_parse_url($add_video_url, PHP_URL_PATH);
						if (is_string($path)) {
							$checked = wp_check_filetype(basename($path));
							if (! empty($checked['type'])) {
								$vid_mime = $checked['type'];
							}
						}
					}
					?>
					<div class="section-divider" aria-hidden="true"></div>
					<section class="media-section case-study-video-section" aria-label="<?php esc_attr_e('Project video', 'viitorx'); ?>" data-section-reveal>
						<div class="container">
							<?php if ($vid_mime && 0 === strpos($vid_mime, 'video/')) : ?>
								<video class="media-section__video" controls playsinline preload="metadata">
									<source src="<?php echo esc_url($add_video_url); ?>" type="<?php echo esc_attr($vid_mime); ?>">
									<?php esc_html_e('Your browser does not support embedded video.', 'viitorx'); ?>
								</video>
							<?php else : ?>
								<p class="text-body">
									<a href="<?php echo esc_url($add_video_url); ?>" class="case-study-video-link"><?php esc_html_e('Download / view media file', 'viitorx'); ?></a>
								</p>
							<?php endif; ?>
						</div>
					</section>
				<?php endif; ?>

				<?php if ($has_why) : ?>
					<div class="section-divider" aria-hidden="true"></div>
					<section class="content-section" aria-label="<?php esc_attr_e('Why choose ViitorX', 'viitorx'); ?>" data-section-reveal>
						<div class="container content-section__inner cs-content-split">
							<?php if (! empty($why_nia['title'])) : ?>
								<h2 class="content-section__title"><?php echo esc_html($why_nia['title']); ?></h2>
							<?php endif; ?>
							<?php if (! empty($why_nia['description'])) : ?>
								<div class="content-section__body">
									<div class="text-intro case-study-rich"><?php echo wp_kses_post($why_nia['description']); ?></div>
								</div>
							<?php endif; ?>
						</div>
					</section>
				<?php endif; ?>

				<?php if ($has_testimonial) : ?>
					<div class="section-divider" aria-hidden="true"></div>
					<section class="cs-testimonial" aria-label="<?php esc_attr_e('Testimonial', 'viitorx'); ?>" data-section-reveal>
						<div class="container cs-testimonial__inner">
							<span class="cs-testimonial__mark" aria-hidden="true"><?php echo '&ldquo;'; ?></span>
							<?php if (! empty($testimonial['quote'])) : ?>
								<blockquote class="cs-testimonial__blockquote">
									<p class="cs-testimonial__quote"><?php echo wp_kses_post($testimonial['quote']); ?></p>
								</blockquote>
							<?php endif; ?>
							<?php if (! empty($testimonial['designation'])) : ?>
								<p class="cs-testimonial__designation"><?php echo wp_kses_post($testimonial['designation']); ?></p>
							<?php endif; ?>
							<?php if (! empty($testimonial['brief'])) : ?>
								<p class="cs-testimonial__brief"><?php echo wp_kses_post($testimonial['brief']); ?></p>
							<?php endif; ?>
						</div>
					</section>
				<?php endif; ?>

				<?php if ($has_results) : ?>
					<div class="section-divider" aria-hidden="true"></div>
					<section class="content-section cs-results" aria-label="<?php esc_attr_e('Results', 'viitorx'); ?>" data-section-reveal>
						<div class="container content-section__inner cs-content-split">
							<?php if (! empty($results_acf['title'])) : ?>
								<h2 class="content-section__title cs-results__title"><?php echo esc_html($results_acf['title']); ?></h2>
							<?php endif; ?>
							<div class="content-section__body cs-results__body">
								<?php if (! empty($results_acf['description'])) : ?>
									<div class="text-intro cs-results__lead case-study-rich"><?php echo wp_kses_post($results_acf['description']); ?></div>
								<?php endif; ?>
								<?php if (! empty($results_acf['add_key_points']) && is_array($results_acf['add_key_points'])) : ?>
									<ul class="bullets cs-results__list" aria-label="<?php esc_attr_e('Results', 'viitorx'); ?>">
										<?php foreach ($results_acf['add_key_points'] as $pt) : ?>
											<?php if (! is_array($pt)) {
												continue;
											} ?>
											<li class="bullets__item cs-results__item">
												<?php if (! empty($pt['title'])) : ?>
													<strong class="cs-results__item-title"><?php echo esc_html($pt['title']); ?>:</strong>
												<?php endif; ?>
												<?php if (! empty($pt['description'])) : ?>
													<span class="cs-results__item-desc"><?php echo wp_kses_post($pt['description']); ?></span>
												<?php endif; ?>
											</li>
										<?php endforeach; ?>
									</ul>
								<?php endif; ?>
							</div>
						</div>
					</section>
				<?php endif; ?>

				<?php if ($has_conclusion) : ?>
					<div class="section-divider" aria-hidden="true"></div>
					<section class="content-section cs-conclusion" aria-label="<?php esc_attr_e('Conclusion', 'viitorx'); ?>" data-section-reveal>
						<div class="container content-section__inner cs-content-split">
							<?php if (! empty($conclusion_acf['title'])) : ?>
								<h2 class="content-section__title cs-conclusion__title"><?php echo esc_html($conclusion_acf['title']); ?></h2>
							<?php endif; ?>
							<?php if (! empty($conclusion_acf['description'])) : ?>
								<div class="content-section__body cs-conclusion__body">
									<div class="text-intro case-study-rich"><?php echo wp_kses_post($conclusion_acf['description']); ?></div>
								</div>
							<?php endif; ?>
						</div>
					</section>
				<?php endif; ?>

			<?php else : ?>

				<div class="cs-container" data-section-reveal>
					<?php
					the_content();
					if ($gallery_1 || $gallery_2) :
					?>
						<section class="cs-gallery" aria-label="<?php esc_attr_e('Project gallery', 'viitorx'); ?>">
							<?php if ($gallery_1) : ?>
								<div class="cs-gallery__item">
									<img src="<?php echo esc_url($gallery_1); ?>" alt="" class="cs-gallery__img" loading="lazy" decoding="async">
								</div>
							<?php endif; ?>
							<?php if ($gallery_2) : ?>
								<div class="cs-gallery__item">
									<img src="<?php echo esc_url($gallery_2); ?>" alt="" class="cs-gallery__img" loading="lazy" decoding="async">
								</div>
							<?php endif; ?>
						</section>
					<?php endif; ?>
					<?php if ($wide_media) : ?>
						<section class="cs-hero-media" aria-label="<?php esc_attr_e('Project wide image', 'viitorx'); ?>" style="background-image: url('<?php echo esc_url($wide_media); ?>'); margin-bottom: 80px; border-radius: 24px;"></section>
					<?php endif; ?>
				</div>

			<?php endif; ?>

			<?php get_template_part( 'template-parts/contact-form-section' ); ?>

		</main>
	</div>

<?php
endwhile;

get_footer();