/** * Loop through the specified custom theme template files. * * @since 0.1.0 */ public static function custom_widget_area_loop($sidebar_hook = '', $fallback_default_widget_area_name = '', $fallback_default_file = '', $show_default = false, $default_file = '', $check_global = false) { global $pc_template; /* Default to post widget area if nothing else specified. */ if (empty($fallback_default_file)) { $fallback_default_file = 'primary_post_generic_default_widgets.php'; } 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 = PC_Hooks::pc_custom_primary_sidebar_archive($custom_pages); /* Framework hook wrapper */ break; case 'primary-pages': $custom_pages = PC_Hooks::pc_custom_primary_sidebar_pages($custom_pages); /* Framework hook wrapper */ break; case 'primary-posts': $custom_pages = PC_Hooks::pc_custom_primary_sidebar_posts($custom_pages); /* Framework hook wrapper */ break; default: $custom_pages = array(); } $custom_pages_flag = 0; foreach ($custom_pages as $custom_page => $widget_area) { if ($pc_template == $custom_page) { self::render_widget_area($widget_area, $show_default, $default_file, $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, $fallback_default_file, true); } }