2023-03-01 05:17:12 +00:00
|
|
|
package wp
|
2023-02-16 15:12:16 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2023-05-04 12:37:06 +00:00
|
|
|
"github.com/fthvgb1/wp-go/app/pkg/cache"
|
2023-02-16 15:12:16 +00:00
|
|
|
"github.com/fthvgb1/wp-go/helper/html"
|
|
|
|
)
|
|
|
|
|
2023-02-23 15:42:51 +00:00
|
|
|
func CalCustomCss(h *Handle) (r string) {
|
2023-02-28 15:38:23 +00:00
|
|
|
if h.themeMods.CustomCssPostId < 1 {
|
2023-02-16 15:12:16 +00:00
|
|
|
return
|
|
|
|
}
|
2023-02-28 15:38:23 +00:00
|
|
|
post, err := cache.GetPostById(h.C, uint64(h.themeMods.CustomCssPostId))
|
2023-02-16 15:12:16 +00:00
|
|
|
if err != nil || post.Id < 1 {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
r = fmt.Sprintf(`<style id="wp-custom-css">%s</style>`, html.StripTags(post.PostContent, ""))
|
|
|
|
return
|
|
|
|
}
|