/** * Loop through the specified theme custom page template files. * * @since 0.1.0 */ public static function custom_widget_area_loop($sidebar_hook = null, $fallback_default_widget_area_name = null, $show_default = false, $check_global = false) { global $wpgo_template; /* Default to post widget area if nothing else specified. */ if (empty($fallback_default_widget_area_name)) { $fallback_default_widget_area_name = 'primary-post-widget-area'; } $custom_pages = array(); /* Initialize to empty array. */ /* At the moment this feature only supports (i.e. was only needed for) primary sidebars, but it can be easily extended for secondary sidebars. */ switch ($sidebar_hook) { case 'primary-archive': $custom_pages = WPGo_Hooks::wpgo_custom_primary_sidebar_archive($custom_pages); break; case 'primary-pages': $custom_pages = WPGo_Hooks::wpgo_custom_primary_sidebar_pages($custom_pages); break; case 'primary-posts': $custom_pages = WPGo_Hooks::wpgo_custom_primary_sidebar_posts($custom_pages); break; default: $custom_pages = array(); } $custom_pages_flag = 0; foreach ($custom_pages as $custom_page => $widget_area) { if ($wpgo_template == $custom_page) { self::render_widget_area($widget_area, $show_default, $check_global); $custom_pages_flag = 1; break; } } /* If no custom pages set then show a default widget area. */ if ($custom_pages_flag == 0) { self::render_widget_area($fallback_default_widget_area_name, true, true); } }