/** * Get active areas for template. * If nothing found on the specific template (eg. archive-cars), fallback to the default template (eg. archive) * @param string $template Template * @return array Active sidebars */ public function getActiveAreas($template) { $originalTemplate = $template; $options = get_option('modularity-options'); $active = isset($options['enabled-areas'][$template]) ? $options['enabled-areas'][$template] : array(); self::$isEditing['template'] = $template; // Fallback if (count($active) === 0 && !is_numeric($template) && strpos($template, 'archive-') !== false && !in_array($template, \Modularity\Options\Archives::getArchiveTemplateSlugs())) { $template = explode('-', $template, 2)[0]; self::$isEditing['template'] = $template; $active = isset($options['enabled-areas'][$template]) ? $options['enabled-areas'][$template] : array(); } if (self::$isEditing['title'] == 'archive-post') { $home = \Modularity\Helper\Wp::findCoreTemplates(array('home')); if ($home) { $active = isset($options['enabled-areas']['home']) ? $options['enabled-areas']['home'] : array(); self::$isEditing['template'] = 'home'; } } return $active; }