wp-go/app/theme/wp/customcss.go
2023-05-04 20:37:06 +08:00

20 lines
428 B
Go

package wp
import (
"fmt"
"github.com/fthvgb1/wp-go/app/pkg/cache"
"github.com/fthvgb1/wp-go/helper/html"
)
func CalCustomCss(h *Handle) (r string) {
if h.themeMods.CustomCssPostId < 1 {
return
}
post, err := cache.GetPostById(h.C, uint64(h.themeMods.CustomCssPostId))
if err != nil || post.Id < 1 {
return
}
r = fmt.Sprintf(`<style id="wp-custom-css">%s</style>`, html.StripTags(post.PostContent, ""))
return
}