File: /var/www/html/wp-content/themes/thegem-elementor/archive-thegem_pf_item.php
<?php
get_header();
$context = function_exists( 'ethnic_case_studies_archive_context' ) ? ethnic_case_studies_archive_context() : array();
$grid_query = isset( $context['grid_query'] ) && $context['grid_query'] instanceof WP_Query ? $context['grid_query'] : new WP_Query();
$featured = isset( $context['featured_posts'] ) && is_array( $context['featured_posts'] ) ? $context['featured_posts'] : array();
$category_terms = isset( $context['category_terms'] ) && is_array( $context['category_terms'] ) ? $context['category_terms'] : array();
$current_category_term = isset( $context['current_category_term'] ) && $context['current_category_term'] instanceof WP_Term ? $context['current_category_term'] : null;
$result_count = isset( $context['result_count'] ) ? (int) $context['result_count'] : (int) $grid_query->found_posts;
$has_filters = ! empty( $context['has_filters'] );
$config = isset( $context['config'] ) && is_array( $context['config'] ) ? $context['config'] : array();
$archive_url = ! empty( $context['archive_url'] ) ? $context['archive_url'] : ( function_exists( 'ethnic_case_studies_archive_url' ) ? ethnic_case_studies_archive_url() : home_url( '/case-studies/' ) );
$contact_url = function_exists( 'ethnic_case_studies_contact_url' ) ? ethnic_case_studies_contact_url( array( 'intent' => 'consultation' ) ) : home_url( '/contact-us/' );
$hero_visuals = array_slice( $featured, 0, 3 );
$hero_eyebrow = isset( $config['hero_eyebrow'] ) ? $config['hero_eyebrow'] : 'Case Studies';
$hero_title = isset( $config['hero_title'] ) ? $config['hero_title'] : 'Case Studies';
$hero_copy = isset( $config['hero_copy'] ) ? $config['hero_copy'] : '';
$hero_points = isset( $config['hero_points'] ) && is_array( $config['hero_points'] ) ? $config['hero_points'] : array();
$intro_kicker = isset( $config['intro_kicker'] ) ? $config['intro_kicker'] : 'Why This Page Matters';
$intro_heading = isset( $config['intro_heading'] ) ? $config['intro_heading'] : '';
$intro_paragraphs = isset( $config['intro_paragraphs'] ) && is_array( $config['intro_paragraphs'] ) ? $config['intro_paragraphs'] : array();
$intro_highlights = isset( $config['intro_highlights'] ) && is_array( $config['intro_highlights'] ) ? $config['intro_highlights'] : array();
$featured_kicker = isset( $config['featured_kicker'] ) ? $config['featured_kicker'] : 'Featured Projects';
$featured_heading = isset( $config['featured_heading'] ) ? $config['featured_heading'] : '';
$listing_kicker = isset( $config['listing_kicker'] ) ? $config['listing_kicker'] : 'All Projects';
$listing_heading = isset( $config['listing_heading'] ) ? $config['listing_heading'] : '';
$listing_heading_filtered = isset( $config['listing_heading_filtered'] ) ? $config['listing_heading_filtered'] : $listing_heading;
$empty_title = isset( $config['empty_title'] ) ? $config['empty_title'] : 'No case studies found';
$empty_copy = isset( $config['empty_copy'] ) ? $config['empty_copy'] : 'We could not find any case studies in this view yet. Return to the full archive to browse everything currently published.';
$empty_button_label = isset( $config['empty_button_label'] ) ? $config['empty_button_label'] : 'View All Case Studies';
$cta_kicker = isset( $config['cta_kicker'] ) ? $config['cta_kicker'] : 'Start The Conversation';
$cta_heading = isset( $config['cta_heading'] ) ? $config['cta_heading'] : 'Have a project in mind?';
$cta_copy = isset( $config['cta_copy'] ) ? $config['cta_copy'] : '';
$cta_primary_label = isset( $config['cta_primary_label'] ) ? $config['cta_primary_label'] : 'Book a Consultation';
$cta_primary_url = isset( $config['cta_primary_url'] ) ? $config['cta_primary_url'] : $contact_url;
$cta_secondary_label = isset( $config['cta_secondary_label'] ) ? $config['cta_secondary_label'] : 'Get a Free Quote';
$cta_secondary_url = isset( $config['cta_secondary_url'] ) ? $config['cta_secondary_url'] : ( function_exists( 'ethnic_case_studies_contact_url' ) ? ethnic_case_studies_contact_url( array( 'intent' => 'quote' ) ) : home_url( '/contact-us/' ) );
?>
<div id="main-content" class="main-content">
<div class="ethnic-case-studies">
<section class="ethnic-case-studies__hero">
<div class="container">
<div class="ethnic-case-studies__hero-grid">
<div class="ethnic-case-studies__hero-copy">
<span class="ethnic-case-studies__eyebrow"><?php echo esc_html( $hero_eyebrow ); ?></span>
<h1><?php echo esc_html( $hero_title ); ?></h1>
<p><?php echo esc_html( $hero_copy ); ?></p>
<div class="ethnic-case-studies__hero-actions">
<a class="ethnic-case-studies__button ethnic-case-studies__button--primary" href="<?php echo esc_url( isset( $config['hero_primary_url'] ) ? $config['hero_primary_url'] : ( function_exists( 'ethnic_case_studies_contact_url' ) ? ethnic_case_studies_contact_url( array( 'intent' => 'project' ) ) : home_url( '/contact-us/' ) ) ); ?>"><?php echo esc_html( isset( $config['hero_primary_label'] ) ? $config['hero_primary_label'] : 'Start Your Project' ); ?></a>
<a class="ethnic-case-studies__button ethnic-case-studies__button--ghost" href="<?php echo esc_url( isset( $config['hero_secondary_url'] ) ? $config['hero_secondary_url'] : $contact_url ); ?>"><?php echo esc_html( isset( $config['hero_secondary_label'] ) ? $config['hero_secondary_label'] : 'Talk to Our Team' ); ?></a>
</div>
<ul class="ethnic-case-studies__micro-points">
<?php foreach ( $hero_points as $point ) : ?>
<li><?php echo esc_html( $point ); ?></li>
<?php endforeach; ?>
</ul>
</div>
<div class="ethnic-case-studies__hero-visual" aria-hidden="true">
<div class="ethnic-case-studies__hero-collage">
<?php foreach ( $hero_visuals as $index => $visual_post ) : ?>
<?php
$visual_item = function_exists( 'ethnic_case_studies_build_post_payload' ) ? ethnic_case_studies_build_post_payload( $visual_post ) : array();
if ( empty( $visual_item ) ) {
continue;
}
?>
<div class="ethnic-case-studies__hero-card ethnic-case-studies__hero-card--<?php echo esc_attr( $index + 1 ); ?>">
<div class="ethnic-case-studies__hero-card-frame">
<?php if ( ! empty( $visual_item['image_url'] ) ) : ?>
<img src="<?php echo esc_url( $visual_item['image_url'] ); ?>" alt="" loading="lazy" decoding="async" />
<?php else : ?>
<span class="ethnic-case-studies__hero-card-placeholder"></span>
<?php endif; ?>
<div class="ethnic-case-studies__hero-card-copy">
<span><?php echo esc_html( ! empty( $visual_item['services'][0] ) ? $visual_item['services'][0] : 'Case Study' ); ?></span>
<strong><?php echo esc_html( $visual_item['title'] ); ?></strong>
</div>
</div>
</div>
<?php endforeach; ?>
<div class="ethnic-case-studies__hero-badge ethnic-case-studies__hero-badge--primary"><?php echo esc_html( isset( $config['hero_badge_primary'] ) ? $config['hero_badge_primary'] : 'Digital project portfolio' ); ?></div>
<div class="ethnic-case-studies__hero-badge ethnic-case-studies__hero-badge--secondary"><?php echo esc_html( isset( $config['hero_badge_secondary'] ) ? $config['hero_badge_secondary'] : 'Strategy to scale' ); ?></div>
</div>
</div>
</div>
</div>
</section>
<section class="ethnic-case-studies__section ethnic-case-studies__section--intro">
<div class="container">
<div class="ethnic-case-studies__intro-grid">
<div class="ethnic-case-studies__intro-copy">
<span class="ethnic-case-studies__section-kicker"><?php echo esc_html( $intro_kicker ); ?></span>
<h2><?php echo esc_html( $intro_heading ); ?></h2>
<?php foreach ( $intro_paragraphs as $paragraph ) : ?>
<p><?php echo esc_html( $paragraph ); ?></p>
<?php endforeach; ?>
</div>
<div class="ethnic-case-studies__intro-highlights">
<?php foreach ( $intro_highlights as $highlight ) : ?>
<div class="ethnic-case-studies__intro-highlight">
<strong><?php echo esc_html( isset( $highlight['title'] ) ? $highlight['title'] : '' ); ?></strong>
<span><?php echo esc_html( isset( $highlight['copy'] ) ? $highlight['copy'] : '' ); ?></span>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</section>
<?php if ( ! empty( $category_terms ) ) : ?>
<section class="ethnic-case-studies__section ethnic-case-studies__section--categories">
<div class="container">
<div class="ethnic-case-studies__section-head ethnic-case-studies__section-head--compact">
<div>
<span class="ethnic-case-studies__section-kicker">Categories</span>
<h2>Browse case studies by category.</h2>
</div>
</div>
<div class="ethnic-case-studies__category-nav" aria-label="Case study categories">
<a class="ethnic-case-studies__category-chip<?php echo $current_category_term ? '' : ' is-active'; ?>" href="<?php echo esc_url( function_exists( 'ethnic_case_studies_archive_url' ) ? ethnic_case_studies_archive_url() : home_url( '/case-studies/' ) ); ?>">All Case Studies</a>
<?php foreach ( $category_terms as $category_term ) : ?>
<?php if ( ! ( $category_term instanceof WP_Term ) ) : ?>
<?php continue; ?>
<?php endif; ?>
<a class="ethnic-case-studies__category-chip<?php echo ( $current_category_term && $current_category_term->term_id === $category_term->term_id ) ? ' is-active' : ''; ?>" href="<?php echo esc_url( function_exists( 'ethnic_case_studies_category_archive_url' ) ? ethnic_case_studies_category_archive_url( $category_term ) : home_url( '/case-studies/' . $category_term->slug . '/' ) ); ?>">
<?php echo esc_html( $category_term->name ); ?>
</a>
<?php endforeach; ?>
</div>
</div>
</section>
<?php endif; ?>
<section class="ethnic-case-studies__section ethnic-case-studies__section--grid">
<div class="container">
<?php if ( $grid_query->have_posts() ) : ?>
<div class="ethnic-case-studies__grid">
<?php while ( $grid_query->have_posts() ) : ?>
<?php
$grid_query->the_post();
$item = function_exists( 'ethnic_case_studies_build_post_payload' ) ? ethnic_case_studies_build_post_payload( get_post() ) : array();
if ( empty( $item ) ) {
continue;
}
?>
<article class="ethnic-case-studies__card">
<a class="ethnic-case-studies__card-media" href="<?php echo esc_url( $item['url'] ); ?>" aria-label="<?php echo esc_attr( 'View case study: ' . $item['title'] ); ?>">
<?php if ( ! empty( $item['image_url'] ) ) : ?>
<img src="<?php echo esc_url( $item['image_url'] ); ?>" alt="<?php echo esc_attr( $item['image_alt'] ); ?>" loading="lazy" decoding="async" />
<?php else : ?>
<span class="ethnic-case-studies__card-placeholder" aria-hidden="true"></span>
<?php endif; ?>
</a>
<div class="ethnic-case-studies__card-body">
<div class="ethnic-case-studies__card-tags" aria-label="<?php echo esc_attr( $item['title'] . ' tags' ); ?>">
<?php foreach ( $item['services'] as $service ) : ?>
<span class="ethnic-case-studies__tag ethnic-case-studies__tag--service"><?php echo esc_html( $service ); ?></span>
<?php endforeach; ?>
<?php foreach ( $item['platforms'] as $platform ) : ?>
<span class="ethnic-case-studies__tag ethnic-case-studies__tag--platform"><?php echo esc_html( $platform ); ?></span>
<?php endforeach; ?>
<?php foreach ( $item['industries'] as $industry ) : ?>
<span class="ethnic-case-studies__tag ethnic-case-studies__tag--industry"><?php echo esc_html( $industry ); ?></span>
<?php endforeach; ?>
</div>
<h3><a href="<?php echo esc_url( $item['url'] ); ?>"><?php echo esc_html( $item['title'] ); ?></a></h3>
<p><?php echo esc_html( $item['summary'] ); ?></p>
<div class="ethnic-case-studies__result-row" aria-label="<?php echo esc_attr( $item['title'] . ' result highlights' ); ?>">
<?php foreach ( function_exists( 'ethnic_case_studies_result_highlights' ) ? ethnic_case_studies_result_highlights( $item['id'] ) : array() as $result ) : ?>
<span class="ethnic-case-studies__result-pill"><?php echo esc_html( $result ); ?></span>
<?php endforeach; ?>
</div>
<a class="ethnic-case-studies__link" href="<?php echo esc_url( $item['url'] ); ?>" aria-label="<?php echo esc_attr( 'Read case study: ' . $item['title'] ); ?>">
Read Case Study
</a>
</div>
</article>
<?php endwhile; ?>
</div>
<?php
wp_reset_postdata();
if ( $grid_query->max_num_pages > 1 ) {
echo '<nav class="ethnic-case-studies__pagination" aria-label="Case study pagination">';
echo paginate_links(
array(
'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
'format' => '',
'current' => max( 1, (int) get_query_var( 'paged' ) ),
'total' => (int) $grid_query->max_num_pages,
'type' => 'list',
'prev_text' => 'Previous',
'next_text' => 'Next',
)
);
echo '</nav>';
}
?>
<?php else : ?>
<div class="ethnic-case-studies__empty">
<h3><?php echo esc_html( $empty_title ); ?></h3>
<p><?php echo esc_html( $empty_copy ); ?></p>
<a class="ethnic-case-studies__button ethnic-case-studies__button--primary" href="<?php echo esc_url( $archive_url ); ?>"><?php echo esc_html( $empty_button_label ); ?></a>
</div>
<?php endif; ?>
</div>
</section>
<section class="ethnic-case-studies__section ethnic-case-studies__section--cta">
<div class="container">
<div class="ethnic-case-studies__cta">
<div>
<span class="ethnic-case-studies__section-kicker"><?php echo esc_html( $cta_kicker ); ?></span>
<h2><?php echo esc_html( $cta_heading ); ?></h2>
<p><?php echo esc_html( $cta_copy ); ?></p>
</div>
<div class="ethnic-case-studies__cta-actions">
<a class="ethnic-case-studies__button ethnic-case-studies__button--primary" href="<?php echo esc_url( $cta_primary_url ); ?>"><?php echo esc_html( $cta_primary_label ); ?></a>
<a class="ethnic-case-studies__button ethnic-case-studies__button--ghost" href="<?php echo esc_url( $cta_secondary_url ); ?>"><?php echo esc_html( $cta_secondary_label ); ?></a>
</div>
</div>
</div>
</section>
</div>
</div>
<?php
get_footer();