File: /home/mirz4654/public_html/wp-content/themes/mira-yosomite/page.php
<?php get_header(); ?>
<!-- ============ Content =============== -->
<?php
$parents = get_post_ancestors(get_the_ID());
$id = ($parents) ? $parents[count($parents) - 1] : $post->ID;
$parent = get_post($id);
$class = $parent->post_name;
if ($class == 'our-team') {
$main_thumb = myt_thumb($parent->ID, 'full');
} else {
$main_thumb = myt_thumb(get_the_ID(), 'full');
}
?>
<main class="main-content">
<div class="page-container">
<div class="section hero-area h-full-screen" data-parallax="scroll" data-position="top" data-image-src="<?php echo $main_thumb; ?>" data-natural-width="1400" data-natural-height="900">
<div class="overlay"></div>
<div class="pos-tb-center">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="t-center t-uppercase color-white font-50"><?php the_title(); ?></h2>
</div>
</div>
</div>
</div>
</div>
<div <?php post_class('section ptb-60'); ?> id="page-<?php the_ID(); ?>">
<div class="container">
<?php
// Start the loop.
while (have_posts()) : the_post();
$page_slug = $post->post_name;
$args = array(
'sort_column' => 'menu_order',
'sort_order' => 'ASC',
'child_of' => get_the_ID()
);
$children = get_pages($args);
if (!empty($children)) {
// The post has at least one child
?>
<div class="row mb-40">
<div class="col-lg-8 col-md-10 col-sm-10 col-xs-12 col-xs-center t-center mb-40">
<h2 class="mb-20 font-24 t-uppercase"><?php echo (get_post_custom_values('page-tagline', get_the_ID()) != '') ? get_post_custom_values('page-tagline', get_the_ID())[0] : 'WHAT WE CAN DO' ?></h2>
<div class="color-mid"><?php the_content(); ?></div>
</div>
</div>
<div class="row row-tb-15">
<?php
$column = (is_int(count($children) / 3)) ? 'col-md-4' : 'col-md-6';
$column_count = (is_int(count($children) / 3)) ? 3 : 2;
$y = 1;
$z = 0;
foreach ($children as $services_child) :
if ($page_slug != 'our-team') :
?>
<div class="<?php echo $column; ?> col-sm-6">
<div class="service-item">
<div class="service-item">
<a href="<?php echo get_page_link($services_child->ID); ?>">
<figure class="embed-responsive embed-responsive-16by9" data-bg-img="<?php echo myt_thumb($services_child->ID, 'thumbnail'); ?>" style="background-image: url("<?php echo myt_thumb($services_child->ID, 'thumbnail'); ?>");"></figure>
</a>
</div>
<div class="service-desc p-15">
<h5 class="mb-10 t-uppercase"><a href="<?php echo get_page_link($services_child->ID); ?>"><?php echo $services_child->post_title; ?></a></h5>
<p class="mb-5 color-mid"><?php echo $services_child->post_excerpt; ?></p>
</div>
</div>
</div>
<?php
else :
?>
<div class="<?php echo $column; ?> col-sm-6 team-member">
<figure class="team-member-img">
<a href="<?php echo get_page_link($services_child->ID); ?>">
<img src="<?php echo myt_thumb($services_child->ID, 'thumbnail'); ?>" alt="" class="img-responsive">
</a>
</figure>
<h5 class="mt-15 mb-5 t-uppercase">
<a href="<?php echo get_page_link($services_child->ID); ?>">
<?php echo $services_child->post_title; ?>
</a>
</h5>
<p class="mb-10 t-uppercase"><?php echo (get_post_custom_values('page-tagline', $services_child->ID) != '') ? get_post_custom_values('page-tagline', $services_child->ID)[0] : '—' ?></p>
<p class="color-mid"><?php echo $services_child->post_excerpt; ?></p>
</div>
<?php
endif;
$z++;
if($column_count === $y && ($z < (count($children)-1))) {
echo '</div><div class="row row-tb-15">';
$y = 0;
}
$y++;
endforeach;
?>
</div>
<?php
} else {
// There is no child for this post
if (get_post_custom_values('page-tagline', get_the_ID()) != ''):
?>
<div class="row">
<div class="col-lg-8 col-md-10 col-sm-10 col-xs-12 col-xs-center t-center mb-40">
<h2 class="mb-20 font-24 t-uppercase"><?php echo get_post_custom_values('page-tagline', get_the_ID())[0]; ?></h2>
</div>
</div>
<?php
endif;
?>
<div class="row row-tb-15">
<?php if ($class != 'our-team') : ?>
<div class="col-md-12 col-sm-12 color-mid">
<?php the_content(); ?>
</div>
<?php else : ?>
<div class="row row-md-cell mb-20">
<div class="col-md-6 pb-30">
<img src="<?php echo myt_thumb(get_the_ID(), 'full'); ?>" alt="">
</div>
<div class="col-md-6 pb-30">
<?php the_content(); ?>
</div>
</div>
<?php endif; ?>
</div>
<?php
}
?>
<?php endwhile; ?>
</div>
</div>
</div>
</main>
<?php get_footer(); ?>