<?php /* Template Name: Sidebar - Parent Sub-Menu */ ?>
<?php get_header(); ?>
<?php if($_GET['intent'] != 'in_app') { ?>
<div class="container-fluid container-full-width">
  <div class="col-md-12">
    <ul class="breadcrumb">
      <?php display_bc($post->post_parent); ?>
    </ul>
  </div>
</div>
<header class="header page-title">
  <div class="container">
    <h1 data-role="page-title">
      <?php the_title() ?>
    </h1>
  </div>
</header>
<?php } ?>
<section id="content" role="main">
<div class="container-fluid">
<div class="container">
  <div class="row">
    <?php if($_GET['intent'] != 'in_app') { ?>
    <div class="col-md-4 col-lg-3">
      <?php
      if ( is_page() ) {
        global $post;
        $parents = get_post_ancestors( $post->ID );
        $id = ( $parents ) ? $parents[ count( $parents ) - 1 ] : $post->ID;
        $parent = get_post( $id );
        $menu_name = $parent->post_name;

        if ( has_nav_menu( $menu_name ) ) {
          wp_nav_menu( array(
            'theme_location' => $menu_name,
            'menu_class' => 'fp-sub-menu',
            'depth' => 0 ) );
        }
      }
      ?>
    </div>
    <div class="col-md-8 col-lg-9">
      <?php } else { ?>
      <div class="col-xs-12">
        <?php } ?>
        <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">
              <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>
              <?php the_content(); ?>
            </section>
          </article>
          <?php endwhile; endif; ?>
        </section>
      </div>
    </div>
  </div>
</div>
</section>
<?php get_footer(); ?>
