File: /var/www/americahealthline.com/wp-content/themes/americahealthhaven/home.php
<?php
/*
** Template Name: Home
*/
get_header(); ?>
<!-- banner area start -->
<section class="slider-sec">
<div class="slider-container">
<button class="slider-arrow left" id="left-arrow">←</button>
<div class="slider">
<?php if (have_rows('top_content','option')) : ?>
<?php while (have_rows('top_content','option')) : the_row(); ?>
<?php
$slider_image = get_sub_field('top_content_image');
$slider_title = get_sub_field('top_content_text');
?>
<div class="slider-item">
<?php if ($slider_image) : ?>
<img src="<?php echo esc_url($slider_image['url']); ?>" alt="<?php echo esc_attr($slider_image['alt']); ?>" />
<?php endif; ?>
<?php if ($slider_title) : ?>
<p><?php echo esc_html($slider_title); ?></p>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<button class="slider-arrow right" id="right-arrow">→</button>
</div>
</section>
<section class="banner-sec" style="background-image:url('https://wordpressc.goigi.biz/americahealthhaven/wp-content/uploads/2026/06/banner-img.jpg');">
<div class="container">
<div class="row">
<div class="banner-main-div">
<div class="search-container" id="searchContainer">
<div class="search-box">
<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div class="search-inner social-box align-items-center">
<input type="search" class="search-field" name="s" placeholder="Search here..." value="<?php echo get_search_query(); ?>" />
<input type="hidden" name="post_type" value="threads" />
<button type="submit" class="search-btn">Search</button>
</div>
</form>
<div class="auto-search-results"></div>
</div>
</div>
<div class="social-links-main">
<div class="container">
<div class="d-flex justify-content-center ">
<?php if (have_rows('header_social_media','option')) : ?>
<?php while (have_rows('header_social_media','option')) : the_row(); ?>
<?php
$social_url = get_sub_field('header_social_media_link');
$icon_class = get_sub_field('header_social_media_class');
?>
<div class="col-box mx-3">
<a href="<?php echo esc_url($social_url); ?>" target="_blank">
<i class="<?php echo esc_attr($icon_class); ?>"></i>
</a>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- banner area end -->
<!-- news content area start -->
<section class="news-sec mt-5">
<div class="container-fluid">
<div class="row">
<div class="col-lg-9">
<div class="news-content-div">
<div class="news-content-div-img">
<img src="<?php echo bloginfo('template_directory'); ?>/image/news-image-1.jpg" alt="">
</div>
<div class="news-content-div-text">
<?php the_content(); ?>
<!--<a href="#" class="cmn-btn">Read More</a>-->
</div>
</div>
<div class="row">
<?php
$args = array(
'post_type' => 'post',
'order' => 'ASC', // ascending order
'orderby' => 'date', // order by date
'posts_per_page' => 3,
'category_name' => 'featured-topics'
);
$custom_query = new WP_Query($args);
if ($custom_query->have_posts()) :
while ($custom_query->have_posts()) : $custom_query->the_post();
?>
<div class="col-lg-3">
<div class="news-tab-content">
<div class="news-tab-content-img">
<img src="<?php echo the_post_thumbnail_url(); ?>" alt="">
</div>
<div class="news-tab-content-text">
<a href="<?php the_permalink(); ?>"><h6><?php the_title(); ?></h6></a>
</div>
</div>
</div>
<!--<div class="col-lg-3">-->
<!-- <div class="news-tab-content">-->
<!-- <div class="news-tab-content-img">-->
<!-- <img src="<?php echo bloginfo('template_directory'); ?>/image/Depressive Disorders.jpg" alt="">-->
<!-- </div>-->
<!-- <div class="news-tab-content-text">-->
<!-- <a href=""><h6>Depression goes beyond occasional sadness. Major depressive disorder (MDD)</h6></a>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
<!--<div class="col-lg-3">-->
<!-- <div class="news-tab-content">-->
<!-- <div class="news-tab-content-img">-->
<!-- <img src="<?php echo bloginfo('template_directory'); ?>/image/Bipolar Disorder.jpg" alt="">-->
<!-- </div>-->
<!-- <div class="news-tab-content-text">-->
<!-- <a href=""><h6>Bipolar disorder is characterized by mood swings that range from depressive lows</h6></a>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
<!--<div class="col-lg-3">-->
<!-- <div class="news-tab-content">-->
<!-- <div class="news-tab-content-img">-->
<!-- <img src="<?php echo bloginfo('template_directory'); ?>/image/Post-Traumatic Stress Disorder (PTSD).jpg" alt="">-->
<!-- </div>-->
<!-- <div class="news-tab-content-text">-->
<!-- <a href="#">-->
<!-- <h6>PTSD can develop after experiencing or witnessing a traumatic event, such as combat</h6>-->
<!-- </a>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
<?php endwhile; endif; wp_reset_postdata(); ?>
</div>
</div>
<div class="col-lg-3">
<h2>Weather</h2>
<div class="news-ad-div">
<?php echo do_shortcode('[weather_forecast_ny]'); ?>
</div>
</div>
</div>
</div>
</section>
<!-- news content area end -->
<!-- story area start -->
<section class="story-sec mt-5">
<div class="container-fluid">
<h3>Science Updates</h3>
<div class="row">
<div class="col-lg-9">
<?php
$args = array(
'post_type' => 'post',
'order' => 'ASC', // ascending order
'orderby' => 'date', // order by date
'posts_per_page' => 3,
'category_name' => 'science-updates'
);
$custom_query = new WP_Query($args);
if ($custom_query->have_posts()) :
while ($custom_query->have_posts()) : $custom_query->the_post();
?>
<div class="row align-items-center">
<div class="col-lg-4">
<div class="story-main-img mt-5">
<img src="<?php echo the_post_thumbnail_url(); ?>" alt="">
</div>
</div>
<div class="col-lg-8">
<div class="story-main-content">
<div class="story-main-content-top">
<!--<span>World</span><span>Yoga</span>-->
</div>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<p><?php echo wp_trim_words( get_the_content(), 25, '...' ); ?></p>
<div class="story-main-content-btm">
<!--<i class="fa-solid fa-comments"></i>-->
<!--<span>5 min read</span>-->
</div>
</div>
</div>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
</div>
<div class="col-lg-3">
<h2>Trending Now</h2>
<div class="story-sec-ad-div">
<?php echo do_shortcode('[trend_box]'); ?>
<?php //echo do_shortcode('[twitter_feed_id user_id="31187736" count="2"]'); ?>
</div>
</div>
</div>
<div class="row mt-5">
<!-- Story 1 -->
<!--<div class="col-lg-9">-->
<!-- <div class="row align-items-center">-->
<!--<div class="col-lg-4">-->
<!-- <div class="story-main-img">-->
<!-- <img src="<?php echo bloginfo('template_directory'); ?>/image/Understanding Anxiety.jpg" alt="Understanding Anxiety">-->
<!-- </div>-->
<!--</div>-->
<!--<div class="col-lg-8">-->
<!-- <div class="story-main-content">-->
<!-- <div class="story-main-content-top">-->
<!-- <span>Anxiety</span><span>Mental Health</span>-->
<!-- </div>-->
<!-- <a href="/stories/understanding-anxiety">Understanding Anxiety</a>-->
<!-- <p>Learn to recognize the signs of anxiety and discover practical strategies to find calm in your daily life.</p>-->
<!-- <div class="story-main-content-btm">-->
<!-- <i class="fa-solid fa-comments"></i>-->
<!-- <span>7 min read</span>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
<!-- </div>-->
<!--</div>-->
<!--<div class="col-lg-3">-->
<!-- <h2>Trending News</h2>-->
<!-- <div class="story-sec-ad-div">-->
<?php //echo do_shortcode('[trend_box]'); ?>
<!-- </div>-->
<!--</div>-->
<!-- </div>-->
</section>
<!-- story area end -->
<!-- like area start -->
<section class="like-sec mt-5">
<div class="container-fluid">
<h3>Don’t Miss These</h3>
<div class="row">
<?php
// Define category slugs or IDs to pull posts from multiple categories
$categories = array('acne-pimples', 'add-adhd-childhood', 'anemia', 'ai-in-healthcare', 'allergies'); // use slugs or category IDs
$args = array(
'post_type' => 'post',
'posts_per_page' => 5,
'category_name' => implode(',', $categories),
);
$query = new WP_Query($args);
if ($query->have_posts()) : ?>
<div class="col-lg-9">
<div class="row row-cols-lg-5 row-cols-md-3 row-cols-sm-2 row-cols-1">
<?php while ($query->have_posts()) : $query->the_post(); ?>
<div class="col">
<div class="like-main-div">
<div class="like-main-div-img">
<?php if (has_post_thumbnail()) : ?>
<img src="<?php the_post_thumbnail_url('medium'); ?>" alt="<?php the_title_attribute(); ?>">
<?php else : ?>
<img src="<?php echo get_template_directory_uri(); ?>/image/default.jpg" alt="Default Image">
<?php endif; ?>
</div>
<div class="like-main-div-text">
<a href="<?php the_permalink(); ?>"><h6><?php the_title(); ?></h6></a>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
<?php
endif;
wp_reset_postdata();
?>
<div class="col-lg-3">
<div class="like-sec-ad-div"></div>
</div>
</div>
</div>
</section>
<!-- like area end -->
<!-- story area start -->
<section class="story-sec mt-5">
<div class="container-fluid">
<h3>Health Care</h3>
<div class="row">
<div class="col-lg-9 mb-5">
<?php
$args = array(
'post_type' => 'post',
'order' => 'DESC', // ascending order
'orderby' => 'date', // order by date
'posts_per_page' => 5
);
$custom_query = new WP_Query($args);
if ($custom_query->have_posts()) :
while ($custom_query->have_posts()) : $custom_query->the_post();
?>
<div class="row align-items-center pt-3">
<div class="col-lg-4">
<div class="story-main-img">
<img src="<?php echo the_post_thumbnail_url(); ?>" alt="">
</div>
</div>
<div class="col-lg-8">
<div class="story-main-content">
<div class="story-main-content-top">
<!--<span>World</span><span>Yoga</span>-->
</div>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<p><?php echo wp_trim_words( get_the_content(), 25, '...' ); ?></p>
<div class="story-main-content-btm">
<!--<i class="fa-solid fa-comments"></i>-->
<!--<span>5 min read</span>-->
</div>
</div>
</div>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
<div class="d-flex justify-content-center">
<a href="<?php the_permalink(38); ?>" class="btn btn-primary">Read More</a>
</div>
</div>
<div class="col-xl-3">
<aside class="sidebar px-3 pt-4">
<!-- Latest Blog Posts Widget -->
<div class="sidebar__widget mb-5">
<div class="widget-title border-bottom pb-2 mb-3">
<h4 class="mb-0">Latest Blog</h4>
</div>
<ul class="sidebar__post-list list-unstyled">
<?php
$args = array(
'numberposts' => 9, // Show only latest 5
'post_type' => 'post',
'post_status' => 'publish',
);
$recent_posts = wp_get_recent_posts($args);
foreach ($recent_posts as $recentpost) {
?>
<li class="d-flex mb-3">
<div class="sidebar__post-image flex-shrink-0 me-3">
<?php $blog_image = wp_get_attachment_url(get_post_thumbnail_id($recentpost["ID"])); ?>
<img src="<?php echo esc_url($blog_image); ?>" alt="<?php echo esc_attr($recentpost["post_title"]); ?>" class="img-fluid rounded" style="width: 80px; height: 80px; object-fit: cover;">
</div>
<div class="sidebar__post-content">
<h6 class="mb-1 fw-semibold">
<a href="<?php echo get_permalink($recentpost["ID"]); ?>" class="text-dark text-decoration-none">
<?php echo esc_html($recentpost["post_title"]); ?>
</a>
</h6>
<small class="text-muted">
<i class="fa fa-calendar me-1"></i>
<?php echo get_the_date('M d, Y', $recentpost["ID"]); ?>
</small>
</div>
</li>
<?php } wp_reset_query(); ?>
</ul>
</div>
</aside>
</div>
</div>
</div>
</section>
<!-- story area end -->
<?php get_footer(); ?>