diff --git a/helper/maps/map.go b/helper/maps/map.go index a73099b..869e429 100644 --- a/helper/maps/map.go +++ b/helper/maps/map.go @@ -153,7 +153,7 @@ func MergeBy[K comparable, V any](fn func(k K, v1, v2 V) (V, bool), m ...map[K]V func FilterZeroMerge[K comparable, V any](m ...map[K]V) map[K]V { if len(m) < 1 { - panic("no map") + return nil } else if len(m) < 2 { return m[0] } diff --git a/internal/theme/wp/components/widget/archive.go b/internal/theme/wp/components/widget/archive.go index 2018b9d..55554d8 100644 --- a/internal/theme/wp/components/widget/archive.go +++ b/internal/theme/wp/components/widget/archive.go @@ -47,7 +47,7 @@ func Archive(h *wp.Handle, id string) string { conf := reload.GetAnyValBys("widget-archive-conf", h, func(h *wp.Handle) map[any]any { archivesConfig := archivesConfig() conf := wpconfig.GetPHPArrayVal("widget_archives", archivesConfig, int64(2)) - return conf + return maps.FilterZeroMerge(archivesConfig, conf) }) args := reload.GetAnyValBys("widget-archive-args", h, func(h *wp.Handle) map[string]string {