| Server IP : 35.154.56.2 / Your IP : 216.73.217.116 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-0-189 6.8.0-1029-aws #31-Ubuntu SMP Wed Apr 23 18:20:04 UTC 2025 aarch64 User : ubuntu ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /srv/prima-automation.com/html/wp-content/themes/bapl/ |
Upload File : |
<?php
/**
* The template for displaying single posts and pages.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage BAPL
* @since 1.0.0
*/
get_header('inner');
$taxonomyService = get_terms(array('taxonomy' => 'service', 'hide_empty' => false, 'posts_per_page' => -1));
while ( have_posts() ) : the_post();
$imgSRC = get_the_post_thumbnail_url(get_the_ID(), 'full');
$serviceHeaderImage = get_post_meta(get_the_ID(), 'service-header-image', true);
$headerimgSRC = wp_get_attachment_image_src($serviceHeaderImage, 'full');
$serviceGallery = get_post_meta(get_the_ID(), 'servicegallery', true);
$terms = wp_get_post_terms(get_the_ID(), 'service');
$categorySlug = $terms[0]->slug;
if($terms[0]->parent != 0) {
$parentTerm = get_term_by( 'id', $terms[0]->parent, 'service' );
$parentCategorySlug = $parentTerm->slug;
}
?>
<div class="header-wrapper">
<div class="header-bg" style="background-image: url('<?php echo $headerimgSRC[0]; ?>');"></div>
<div class="overlay"></div>
<div class="container">
<div class="row">
<div class="col-xs-12 col-lg-12 col-md-12">
<h1 class="page-title"><?php echo get_the_title(); ?></h1>
</div>
</div>
</div>
</div>
<?php if(function_exists('bcn_display')) { ?>
<div class="breadcrumbs-wrapper">
<div class="container">
<ol class="breadcrumb">
<?php bcn_display(); ?>
</ol>
</div>
</div>
<?php } ?>
<div class="container">
<div class="row">
<div class="col-lg-9 col-md-9 col-sm-9 col-sm-push-3 col-md-push-3 col-lg-push-3">
<div class="entry-content">
<?php the_content(); ?>
<?php
if(is_array($serviceGallery) && count($serviceGallery)) :
?>
<div class="text-separator"></div>
<div class="content-wrapper inner-gallery clearfix">
<?php
foreach($serviceGallery as $item) {
$thumbImgSRC = wp_get_attachment_image_src($item['service-gallery-image'], 'thumb');
$largeImgSRC = wp_get_attachment_image_src($item['service-gallery-image'], 'full');
?>
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-4 gallery-img">
<a class="fancybox" rel="gal" href="<?php echo $largeImgSRC[0]; ?>">
<img class="img-responsive" src="<?php echo $thumbImgSRC[0]; ?>">
<span class="border-overlay"><span class="zoom"></span></span>
</a>
</div>
<?php
}
?>
</div>
<?php
endif;
?>
</div>
</div>
<?php if(is_array($taxonomyService) && count($taxonomyService)) : ?>
<div class="col-lg-3 col-md-3 col-sm-3 col-sm-pull-9 col-md-pull-9 col-lg-pull-9 sidebar">
<!-- Sidebar content begins -->
<div id="secondary">
<div class="advanced-sidebar-menu">
<h4><span>Browse</span></h4>
<ul>
<?php echo getLeftMenu(0); ?>
<li><a href="http://www.primatransformer.com/" target="_blank">Transformers</a></li>
</ul>
</div>
<a href="<?php echo get_permalink(360); ?>" class="btn btn-download"><img src="<?php echo get_template_directory_uri(); ?>/assets/images/download-brochure-icon.png" alt=""> Download Brochures</a>
<a class="btn btn-download"><img src="<?php echo get_template_directory_uri(); ?>/assets/images/testimonial-icon.png" alt=""> View our Testimonials</a>
</div>
<!-- Sidebar content ends -->
</div>
<?php endif; ?>
</div>
</div>
<?php
endwhile;
?>
<script>
jQuery(document).ready(function () {
jQuery("<?php echo ($parentCategorySlug ? '#secondary li.' . $parentCategorySlug . ', ' : ''); ?>#secondary li.<?php echo $categorySlug; ?>").addClass("active");
jQuery('.fancybox').fancybox({
'padding': 0,
helpers: {
title: {type: 'inside'}
}
});
});
</script>
<?php
get_footer();
function getLeftMenu($parentID, $level=0, $flag=0) {
global $taxonomyService;
if($flag == 0) $string = '<ul>';
foreach($taxonomyService as $service) {
$children = get_terms( $service->taxonomy, array( 'parent' => $service->term_id, 'hide_empty' => false ) );
if($service->parent == $parentID) :
$string .= '<li class="' . ($level == 0 ? 'submenu-one ' : ($level == 1 ? 'submenu-two ' : '')) . $service->slug . '"><a href="' . get_category_link($service->term_id) . '"><span onclick="window.open(\''. get_category_link($service->term_id) .'\', \'_self\')">' . $service->name . '</span></a>';
if($service->count > 0) {
$string .= '<ul>'; $string .= getServices($service->slug);
if($children > 0) $string .= getLeftMenu($service->term_id, $level+1, 1);
} else {
if($children > 0) $string .= getLeftMenu($service->term_id, $level+1, 0);
}
$string .= '</li>';
endif;
}
return $string . ($level != 0 ? '</ul>' : '');
}
function getServices($serviceSlug) {
$args = array('post_type' => 'services', 'tax_query' => array( array( 'taxonomy' => 'service', 'field' => 'slug', 'include_children' => false, 'terms' => array($serviceSlug) ) ), 'post_status' => 'publish', 'posts_per_page' => -1);
$servicesQuery = new WP_Query($args);
if ($servicesQuery->have_posts()) :
while ($servicesQuery->have_posts()) : $servicesQuery->the_post();
$string .= '<li><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></li>';
endwhile;
endif;
return $string;
}
?>