<?php

get_header();

$department_id = types_render_field( "department-id", array( "output" => "raw" ) );
$department_content = types_render_field( "department-content", array( "output" => "html" ) );
$department_title = types_render_field( "display-title", array( "output" => "raw" ) );
$department_breadcrumb = types_render_field( "display-breadcrumb", array( "output" => "raw" ) );
$department_topads = types_render_field( "display-top-ads", array( "output" => "raw" ) );
$department_checkoutbanner = types_render_field( "show-checkout-banner", array( "output" => "raw" ) );
?>
<div class="department-landing">
  <section id="content" role="main">
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <section class="entry-content">
        <div id="fp-checkout-banner" class="checkout-banner"></div>
        <?php if ($department_breadcrumb == "true") : ?>
			<div id="fp-department-breadcrumb" data-department-id="<?php echo $department_id ?>">
			<ul class="breadcrumb">
			<?php display_bc($category->category_parent); ?>
			<?php display_bc(1); ?>
			</ul>
			</div>
		<?php else : ?><?php endif; ?>
        <?php if ($department_topads == "true") : ?>
		  <div id="products-ad-banner" class="products-ad-banner"></div>
		  <?php else : ?><?php endif; ?>
		<?php if ($department_title == "true") : ?>
		  <div id="page-title" class="page-title" data-department-id="<?php echo $department_id ?>"></div>
		 <?php else : ?><?php endif; ?>
        <div id="fp-page-title" class="page-title" data-department-id="<?php echo $department_id ?>"></div>
        <?php the_content() ?>
<?php endwhile; endif; ?>
        <?php if(!empty($department_id)): ?>
        <hr />
		  <div class="department-content"> <?php //echo $department_content; ?> </div>
        <div id="offers-by-savings"></div>
        <div id="products" class="products" data-department-id="<?php echo $department_id ?>"></div>
        <div id="products-ad" data-department-id="<?php echo $department_id ?>"></div>
        <div id="products-offered-together" data-department-id="<?php echo $department_id ?>"></div>
        <div id="products-bought-together" data-department-id="<?php echo $department_id ?>"></div>
        <div id="products-recent" data-department-id="<?php echo $department_id ?>"></div>
        <div id="related-recipes" data-department-id="<?php echo $department_id ?>"></div>
        <?php endif; ?>
      </section>
    </article>
   
  </section>
</div>
<?php get_footer(); ?>
