2023-03-01 05:17:12 +00:00
|
|
|
package wp
|
2023-02-10 16:32:46 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/fthvgb1/wp-go/helper/slice"
|
|
|
|
"github.com/fthvgb1/wp-go/internal/pkg/cache"
|
|
|
|
"github.com/fthvgb1/wp-go/internal/pkg/constraints"
|
2023-03-06 12:53:51 +00:00
|
|
|
"github.com/fthvgb1/wp-go/internal/wpconfig"
|
2023-02-10 16:32:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (h *Handle) WidgetAreaData() {
|
2023-03-06 12:53:51 +00:00
|
|
|
h.ginH["showArchiveCount"] = wpconfig.GetPHPArrayValWithDefaults[int64]("widget_archives", 0, int64(2), "count")
|
|
|
|
h.ginH["archiveDropdown"] = wpconfig.GetPHPArrayValWithDefaults[int64]("widget_archives", 0, int64(2), "dropdown")
|
|
|
|
h.ginH["archiveTitle"] = wpconfig.GetPHPArrayValWithDefaults[string]("widget_archives", "归档", int64(2), "title")
|
|
|
|
|
2023-02-28 15:38:23 +00:00
|
|
|
h.ginH["archives"] = cache.Archives(h.C)
|
|
|
|
h.ginH["recentPosts"] = slice.Map(cache.RecentPosts(h.C, 5), ProjectTitle)
|
|
|
|
h.ginH["categories"] = cache.CategoriesTags(h.C, constraints.Category)
|
|
|
|
h.ginH["recentComments"] = cache.RecentComments(h.C, 5)
|
2023-02-10 16:32:46 +00:00
|
|
|
}
|