File: /var/www/html/acharyarajnikant.com/wp-content/themes/acharyarajnikant/templates/home-template.php
<?php
/**
* Template Name: Home Page
*
* @package Acharya_Rajnikant
*/
get_header();
?>
<!-- Hero Slider Section -->
<!-- Hero Slider Section -->
<section id="heroSlider" class="carousel slide carousel-fade" data-bs-ride="carousel">
<?php if (have_rows('hero_slides')): ?>
<div class="carousel-indicators">
<?php
$i = 0;
while (have_rows('hero_slides')):
the_row();
?>
<button type="button" data-bs-target="#heroSlider" data-bs-slide-to="<?php echo $i; ?>"
class="<?php echo $i === 0 ? 'active' : ''; ?>"></button>
<?php
$i++;
endwhile;
?>
</div>
<div class="carousel-inner">
<?php
$j = 0;
while (have_rows('hero_slides')):
the_row();
$badge = get_sub_field('badge');
$title = get_sub_field('title');
$subtitle = get_sub_field('subtitle');
$bg_image = get_sub_field('background_image');
$btn1_text = get_sub_field('primary_button_text');
$btn1_url = get_sub_field('primary_button_url');
$btn2_text = get_sub_field('secondary_button_text');
$btn2_url = get_sub_field('secondary_button_url');
?>
<div class="carousel-item <?php echo $j === 0 ? 'active' : ''; ?>" style="min-height: 90vh;">
<div class="hero-bg"
style="background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('<?php echo esc_url($bg_image['url'] ?? $bg_image); ?>'); background-size: cover; background-position: center; min-height: 90vh; display: flex; align-items: center;">
<div class="container text-white text-center">
<?php if ($badge): ?>
<span
class="badge bg-theme-accent mb-3 px-3 py-2 rounded-pill animate-fade-in-down"><?php echo esc_html($badge); ?></span>
<?php endif; ?>
<?php if ($j === 0): ?>
<h1 class="display-2 fw-bold text-white mb-4 animate-fade-in-up"><?php echo esc_html($title); ?>
</h1>
<?php else: ?>
<h1 class="display-2 fw-bold mb-4 text-white"><?php echo esc_html($title); ?></h1>
<?php endif; ?>
<?php if ($subtitle): ?>
<p class="lead mb-5 mx-auto animate-fade-in-up" style="max-width: 700px; animation-delay: 0.2s;">
<?php echo esc_html($subtitle); ?>
</p>
<?php endif; ?>
<div class="d-flex gap-3 justify-content-center animate-fade-in-up" style="animation-delay: 0.4s;">
<?php if ($btn1_text && $btn1_url): ?>
<a href="<?php echo esc_url($btn1_url); ?>"
class="btn btn-theme btn-lg px-5 py-3 shadow-lg"><?php echo esc_html($btn1_text); ?></a>
<?php endif; ?>
<?php if ($btn2_text && $btn2_url): ?>
<a href="<?php echo esc_url($btn2_url); ?>"
class="btn btn-outline-light btn-lg px-5 py-3 rounded-pill border-2 fw-bold"><?php echo esc_html($btn2_text); ?></a>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php
$j++;
endwhile;
?>
</div>
<?php else: ?>
<!-- Fallback if no ACF fields are set -->
<div class="carousel-inner">
<div class="carousel-item active" style="min-height: 90vh;">
<div class="hero-bg"
style="background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('https://images.unsplash.com/photo-1517048676732-d65bc937f952?q=80&w=1920&auto=format&fit=crop'); background-size: cover; background-position: center; min-height: 90vh; display: flex; align-items: center;">
<div class="container text-white text-center">
<h1 class="display-2 fw-bold text-white mb-4">Transform Your Life with Ancient Wisdom</h1>
<p class="lead mb-5 mx-auto" style="max-width: 700px;">Please configure your Hero Slides in the
WordPress Dashboard using ACF.</p>
</div>
</div>
</div>
</div>
<?php endif; ?>
</section>
<!-- Stats Section -->
<section class="stats-section py-5 bg-white shadow-sm position-relative"
style="z-index: 10; margin-top: -50px; border-radius: 50px 50px 0 0;">
<div class="container">
<div class="row g-4 text-center">
<?php if (have_rows('stats_repeater')): ?>
<?php while (have_rows('stats_repeater')):
the_row();
$stat_number = get_sub_field('stat_number');
$stat_label = get_sub_field('stat_label');
?>
<div class="col-md-4">
<div class="p-4 rounded-4 transition-all hover-translate-y">
<h3 class="display-4 fw-bold text-theme-primary mb-1"><?php echo esc_html($stat_number); ?></h3>
<p class="text-muted fw-bold text-uppercase small" style="letter-spacing: 2px;">
<?php echo esc_html($stat_label); ?>
</p>
</div>
</div>
<?php endwhile; ?>
<?php else: ?>
<!-- Fallback if no ACF fields are set -->
<div class="col-md-4">
<div class="p-4 rounded-4 transition-all hover-translate-y">
<h3 class="display-4 fw-bold text-theme-primary mb-1">15+</h3>
<p class="text-muted fw-bold text-uppercase small" style="letter-spacing: 2px;">Years of Wisdom</p>
</div>
</div>
<div class="col-md-4">
<div class="p-4 rounded-4 transition-all hover-translate-y">
<h3 class="display-4 fw-bold text-theme-primary mb-1">5000+</h3>
<p class="text-muted fw-bold text-uppercase small" style="letter-spacing: 2px;">Lives Transformed
</p>
</div>
</div>
<div class="col-md-4">
<div class="p-4 rounded-4 transition-all hover-translate-y">
<h3 class="display-4 fw-bold text-theme-primary mb-1">100%</h3>
<p class="text-muted fw-bold text-uppercase small" style="letter-spacing: 2px;">Satisfied Seekers
</p>
</div>
</div>
<?php endif; ?>
</div>
</div>
</section>
<!-- About Section -->
<?php
$about_image = get_field('about_image');
$exp_title = get_field('experience_title');
$exp_year = get_field('experience_year');
$about_badge = get_field('about_badge');
$about_title = get_field('about_title');
$about_lead = get_field('about_lead_text');
$about_main = get_field('about_main_text');
$btn_text = get_field('about_button_text');
$btn_url = get_field('about_button_url');
?>
<section id="about" class="about-section py-5 my-5">
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6 mb-5 mb-lg-0">
<div class="position-relative pe-lg-5 animate-zoom-in">
<?php if ($about_image): ?>
<img src="<?php echo esc_url($about_image['url']); ?>"
alt="<?php echo esc_attr($about_image['alt']); ?>" class="img-fluid rounded-5 shadow-2xl">
<?php else: ?>
<img src="https://images.unsplash.com/photo-1590050752117-238cb0fb12b1?q=80&w=800&auto=format&fit=crop"
alt="Acharya Rajnikant" class="img-fluid rounded-5 shadow-2xl">
<?php endif; ?>
<?php if ($exp_title || $exp_year): ?>
<div class="experience-card bg-theme-primary text-white p-4 rounded-4 position-absolute shadow-lg"
style="bottom: -20px; right: 10px;">
<h4 class="mb-0 fw-bold"><?php echo esc_html($exp_title ?: 'Guiding Souls'); ?></h4>
<p class="small mb-0 opacity-75"><?php echo esc_html($exp_year ?: 'Since 2008'); ?></p>
</div>
<?php endif; ?>
</div>
</div>
<div class="col-lg-6">
<?php if ($about_badge): ?>
<h6 class="text-theme-accent fw-bold text-uppercase mb-3" style="letter-spacing: 2px;">
<?php echo esc_html($about_badge); ?>
</h6>
<?php endif; ?>
<h2 class="display-4 fw-bold mb-4">
<?php echo esc_html($about_title ?: 'Dedicated to Your Spiritual Growth'); ?>
</h2>
<?php if ($about_lead): ?>
<p class="lead text-muted mb-4"><?php echo esc_html($about_lead); ?></p>
<?php endif; ?>
<?php if ($about_main): ?>
<p class="mb-5"><?php echo esc_html($about_main); ?></p>
<?php endif; ?>
<?php if (have_rows('about_features')): ?>
<div class="row g-4 mb-5">
<?php while (have_rows('about_features')):
the_row(); ?>
<div class="col-md-6 d-flex align-items-center gap-3">
<div class="bg-theme-primary-light p-2 rounded-circle">
<i class="bi bi-check-lg text-theme-primary h4 mb-0"></i>
</div>
<span class="fw-bold"><?php the_sub_field('feature_text'); ?></span>
</div>
<?php endwhile; ?>
</div>
<?php else: ?>
<!-- Default features if none specified -->
<div class="row g-4 mb-5">
<div class="col-md-6 d-flex align-items-center gap-3">
<div class="bg-theme-primary-light p-2 rounded-circle">
<i class="bi bi-check-lg text-theme-primary h4 mb-0"></i>
</div>
<span class="fw-bold">Expert Astrologer</span>
</div>
<div class="col-md-6 d-flex align-items-center gap-3">
<div class="bg-theme-primary-light p-2 rounded-circle">
<i class="bi bi-check-lg text-theme-primary h4 mb-0"></i>
</div>
<span class="fw-bold">Vastu Specialist</span>
</div>
</div>
<?php endif; ?>
<a href="<?php echo esc_url($btn_url ?: home_url('/about/')); ?>"
class="btn btn-theme px-5 py-3 shadow-lg">
<?php echo esc_html($btn_text ?: 'मेरे बारे में और जानें'); ?>
</a>
</div>
</div>
</div>
</section>
<section id="services" class="services-section py-5 bg-light">
<div class="container">
<div class="text-center mb-5 pb-3">
<h6 class="text-theme-accent fw-bold text-uppercase mb-3" style="letter-spacing: 2px;">हमारी सेवाएँ</h6>
<h2 class="display-4 fw-bold">जीवन के हर पथ के लिए समाधान</h2>
<div class="mx-auto" style="width: 80px; height: 4px; background: var(--accent-color); border-radius: 2px;">
</div>
</div>
<?php get_template_part('template-parts/services-grid'); ?>
</div>
</section>
<section class="events-section py-5 bg-light mt-5">
<div class="container">
<div class="text-center mb-5 pb-3">
<h6 class="text-theme-accent fw-bold text-uppercase mb-3" style="letter-spacing: 2px;">आगामी कार्यक्रम</h6>
<h2 class="display-4 fw-bold">हमारी आध्यात्मिक यात्रा में शामिल हों</h2>
<div class="mx-auto" style="width: 80px; height: 4px; background: var(--accent-color); border-radius: 2px;">
</div>
</div>
<div class="row g-5">
<?php
// $events_query = new WP_Query(array(
// 'post_type' => 'event',
// 'posts_per_page' => 4,
// 'post_status' => 'publish',
// 'orderby' => 'date',
// 'order' => 'DESC'
// ));
$events_query = new WP_Query(array(
'post_type' => 'event',
'posts_per_page' => 4,
'post_status' => 'publish',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'event_end_date',
'value' => current_time('Y-m-d H:i:s'),
'compare' => '>=',
'type' => 'DATETIME'
),
array(
'key' => 'event_end_date',
'compare' => 'NOT EXISTS'
)
),
'orderby' => 'date',
'order' => 'DESC'
));
if ($events_query->have_posts()):
while ($events_query->have_posts()):
$events_query->the_post();
$start_dt = get_field('event_start_date');
$end_dt = get_field('event_end_date');
$event_date = get_field('event_date');
$event_time = get_field('event_time');
if ($start_dt) {
$start_obj = DateTime::createFromFormat('d/m/Y g:i a', $start_dt);
if ($start_obj) {
$event_date = $start_obj->format('j F Y');
$event_time = $start_obj->format('g:i A');
if ($end_dt) {
$end_obj = DateTime::createFromFormat('d/m/Y g:i a', $end_dt);
if ($end_obj) {
if ($start_obj->format('Ymd') === $end_obj->format('Ymd')) {
$event_time .= ' - ' . $end_obj->format('g:i A');
} else {
if ($start_obj->format('F Y') === $end_obj->format('F Y')) {
$event_date = $start_obj->format('j') . ' - ' . $end_obj->format('j F Y');
} else {
$event_date = $start_obj->format('j F') . ' - ' . $end_obj->format('j F Y');
}
}
}
}
}
}
$event_date = get_field('event_date') ?: 'Date To Be Announced';
$event_venue = get_field('event_venue') ?: 'Venue TBD';
$event_address = get_field('event_address') ?: '';
$event_location = get_field('event_location') ?: 'Location TBD';
$event_time = get_field('event_time') ?: 'Time TBD';
$event_image = get_the_post_thumbnail_url() ?: 'https://images.unsplash.com/photo-1545205597-3d9d02c29597?q=80&w=800&auto=format&fit=crop';
?>
<div class="col-lg-6">
<div class="event-card-modern h-100">
<div class="event-map-top">
<img src="<?php echo esc_url($event_image); ?>" class="w-100 h-100 object-fit-cover"
alt="<?php the_title_attribute(); ?>">
</div>
<div class="event-details-body d-flex flex-column align-items-center">
<h3 class="event-card-title">
<?php the_title(); ?>
</h3>
<div class="event-info-item">
<span class="event-info-label">तारीख: </span>
<span class="event-info-value">
<?php echo esc_html($event_date); ?>
</span>
</div>
<div class="event-info-item">
<span class="event-info-label">कार्यक्रम का स्थान: </span>
<span class="event-info-value">
<?php echo esc_html($event_venue); ?>
</span>
</div>
<?php if ($event_address): ?>
<div class="event-address">
<?php echo esc_html($event_address); ?>
</div>
<?php endif; ?>
<div class="event-info-item">
<span class="event-info-label">जगह: </span>
<span class="event-info-value">
<?php echo esc_html($event_location); ?>
</span>
</div>
<div class="event-info-item">
<span class="event-info-label">समय: </span>
<span class="event-info-value">
<?php echo esc_html($event_time); ?>
</span>
</div>
</div>
</div>
</div>
<?php
endwhile;
wp_reset_postdata();
else:
?>
<div class="col-12 text-center">
<p class="text-muted">No upcoming events currently scheduled. Please check back later.</p>
</div>
<?php endif; ?>
</div>
</div>
</section>
<!-- Dynamic Videos and Shorts Section -->
<?php get_template_part('template-parts/content-videos'); ?>
<?php get_template_part('template-parts/content', 'cta'); ?>
<?php get_footer(); ?>