<?php
/**
 * Sidebar Primary widget area.
 *
 * @package WEN Business
 */
?>

<?php
/**
 * wen_business_action_before_sidebar_primary hook
 */
do_action( 'wen_business_action_before_sidebar_primary' );?>

<?php
  $default_sidebar = apply_filters( 'wen_business_filter_default_sidebar_id', 'sidebar-1', 'primary' );

  if ( is_singular() ) {
    global $post;
    $post_options = get_post_meta( $post->ID, 'theme_settings', true );
    if ( isset( $post_options['sidebar_location_primary'] ) && ! empty( $post_options['sidebar_location_primary'] ) ) {
      $default_sidebar = $post_options['sidebar_location_primary'];
    }
  }
 ?>
<div id="sidebar-primary" role="complementary" <?php wen_business_sidebar_primary_class( 'widget-area sidebar' ); ?> >
  <?php if ( is_active_sidebar( $default_sidebar ) ): ?>

    <?php dynamic_sidebar( $default_sidebar ); ?>

  <?php endif ?>
</div><!-- #sidebar-primary -->
<?php
/**
 * wen_business_action_after_sidebar_primary hook
 */
do_action( 'wen_business_action_after_sidebar_primary' );?>

