<?php
/* 
* Theme: PREMIUMPRESS CORE FRAMEWORK FILE
* Url: www.premiumpress.com
* Author: Mark Fail
*
* THIS FILE WILL BE UPDATED WITH EVERY UPDATE
* IF YOU WANT TO MODIFY THIS FILE, CREATE A CHILD THEME
*
* http://codex.wordpress.org/Child_Themes
*/
if (!defined('THEME_VERSION')) {	header('HTTP/1.0 403 Forbidden'); exit; }

global $CORE, $CORE_UI, $LAYOUT, $wpdb, $wp_query, $userdata;
 
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
 

$term = get_term_by('slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );

$big = 0;
$title = $CORE->GEO("translation_tax", array($term->term_id, $term->name));

$description = "";
if( strlen($term->description) > 0){
	$description  = $term->description;
}elseif( strlen(_ppt('category_description_'.$term->term_id)) >  5){  
	$description = _ppt('category_description_'.$term->term_id);
} 

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
 

?> 

<div class="<?php if(strlen($description) > 2 ) { ?>bg-white border-bottom <?php } ?>">

  <div class="py-3 border-bottom">
    <?php _ppt_template( 'search/search-breadcrumbs' ); ?>
  </div>

  <?php if(strlen($description) > 2 ) { $image = do_shortcode('[CATEGORYIMAGE term_id="'.$term->term_id.'" pathonly=1 big="'.$big.'" tax="'.$term->taxonomy.'" placeholder=0]'); ?>
	
	<div class="container py-3"> 

		<div class="d-flex align-items-center">			

			<?php if(strlen($image) > 1){ ?>
				<div style="max-height:150px; max-width:150px;min-width:100px;" >
						
					<div ppt-border1 class="p-3 text-center mr-4 hide-mobile overflow-hidden">
						
						<img src="<?php echo $image; ?>" alt="<?php echo $title; ?>" class="w-100">
								
					</div>
				</div>		
			<?php } ?>			

			<div class="text-align-left"> 

					<h1 class="fs-md mb-2 mt-1 text-600"><?php echo $title; ?></h1> 

					<span class="opacity-5"><?php echo strip_tags($description); ?></span>


					<?php 
					$cats = get_terms( $GLOBALS['flag-taxonomy-type'], array( 'hide_empty' => 0, 'parent' => $GLOBALS['flag-taxonomy-id']  ));
					
					if(!empty($cats)){
					?>
					<div class="small mt-2"> 
						
						<?php foreach($cats as $term){ ?> 
							<a href="<?php echo get_term_link($term->term_id, $term->taxonomy); ?>" class="text-dark mr-2 font-weight-bold">
								<u><?php echo $CORE->GEO("translation_tax_with_termdata", $term); ?></u>
							</a> 
						<?php } ?> 
						</div>
					
					<?php } ?> 
						
			</div>	
			
		</div>

	</div>

<?php } ?>

</div> 