function _print_page_layout()
 {
     global $post;
     $return = "";
     $parentLayout = get_post_meta($post->ID, '_wipfr_page_parent_layout', true);
     if (!empty($parentLayout) && is_array($parentLayout)) {
         foreach ($parentLayout as $pid => $key) {
             if (isset($key['type'])) {
                 switch ($key['type']) {
                     case 'fullwidth':
                         wip_layout_helper::_delete_global_layout();
                         wip_layout_helper::_make_global_fullwidth();
                         _wipfr_print_fullwidth_module(wip_layout_helper::_get_frontend_content_db($pid, true));
                         wip_layout_helper::_delete_global_layout();
                         break;
                     case 'sidebar_content':
                         wip_layout_helper::_delete_global_layout();
                         wip_layout_helper::_make_global_sidebar();
                         _print_contentsidebar_module('sidebar_content', $pid, wip_layout_helper::_get_frontend_content_db($pid, true), true);
                         wip_layout_helper::_delete_global_layout();
                         break;
                     case 'content_sidebar':
                         wip_layout_helper::_delete_global_layout();
                         wip_layout_helper::_make_global_sidebar();
                         _print_contentsidebar_module('content_sidebar', $pid, wip_layout_helper::_get_frontend_content_db($pid, true), true);
                         wip_layout_helper::_delete_global_layout();
                         break;
                 }
             }
         }
         unset($parentLayout);
     } else {
         #fullwidth for cart and checkout page
         #if user do not setup the page content manager
         if (woocommerce_found() && ($post->ID == (int) woocommerce_get_page_id('cart') || $post->ID == (int) woocommerce_get_page_id('checkout') || $post->ID == (int) woocommerce_get_page_id('view_order'))) {
             wip_layout_helper::_delete_global_layout();
             wip_layout_helper::_make_global_fullwidth();
             $content = '<div class="page_content">' . "\n";
             $content .= apply_filters('the_content', get_the_content($post->ID));
             $content .= '<div class="clear"></div>' . "\n";
             $content .= '</div>' . "\n";
             $f_content = '<div class="wrap_940">' . "\n";
             $f_content .= $content;
             $f_content .= '</div><!-- end .wrap_940 -->' . "\n";
             _wipfr_print_fullwidth_module($f_content);
             wip_layout_helper::_delete_global_layout();
         } else {
             wip_layout_helper::_delete_global_layout();
             wip_layout_helper::_make_global_sidebar();
             $content = '<div class="page_content">' . "\n";
             $content .= apply_filters('the_content', get_the_content($post->ID));
             $content .= '<div class="clear"></div>' . "\n";
             $content .= '</div>' . "\n";
             _print_contentsidebar_module('content_sidebar', $pid, $content, true);
             wip_layout_helper::_delete_global_layout();
         }
     }
 }
 function _wip_output_content_wrapper_end()
 {
     global $woocommerce_loop, $wip_woo_single;
     if (!$wip_woo_single && $woocommerce_loop['parent_layout'] != 'fullwidth') {
         echo '</div><!-- end .area_with_sidebar -->' . "\n";
         /** we have remove woocommerce_get_sidebar() and call sidebar right from here */
         echo '<div class="sidebar_block ' . ($woocommerce_loop['parent_layout'] == 'content-sidebar' ? 'area_right' : 'area_left') . '">' . "\n";
         wip_generated_dynamic_sidebar(get_wip_option_by('bd_shoppage_sidebar', 'Default Sidebar'));
         wp_reset_postdata();
         #woocommerce not reset it's query in lots of widgets!!!
         echo '</div>' . "\n";
         echo '<div class="clear"></div>' . "\n";
     }
     if ($wip_woo_single) {
         echo '<div class="clear"></div>' . "\n";
         echo '</div><!-- end .wip-product-single-page -->' . "\n";
     }
     wip_layout_helper::_delete_global_layout();
     //reset global layout
     echo '</div><!-- end .wrap_960 -->' . "\n";
     echo '</div><!-- end MAIN SECTION -->' . "\n";
 }