<div id="topimage">


	<?php if (is_category()) { 

		$cat_id = get_queried_object_id();

		$img = get_field('topimage', 'category_'.$cat_id);

		$toptitle = single_cat_title('', false);

		

		

		 }  elseif (is_tax()) {

	 $term_id = get_queried_object_id();

	 $term =  get_term( $term_id );

	 $taxname =  $term->taxonomy;

	$toptitle = $term->name;

		$img = get_field('top_image', $taxname.'_'. $term_id);

		 	

		 } else {

		$img = get_field('topimage');

		$toptitle = get_the_title();

		

		 } 

		 
		 if ($img) {
		$size ='topimage';

		$topimg_img = $img['sizes'][ $size ];
		 }
		?>



		<?php if ($img) {?>
       
        <img src="<?php echo $topimg_img; ?>" class="topimg" alt="<?php echo $toptitle; ?>" />

        <?php } else { ?>
        <img src="<?php bloginfo ('template_url'); ?>/images/topimage.png" class="topimg"  alt="<?php echo $toptitle; ?>"  />  
        <?php } ?>
        

			<?php  get_template_part('parts/breadcrumbs'); ?> 
	
   
        </div><!--cont-->


</div><!--topimage-->
