wp-go/app/theme/twentyseventeen/customheader.go

49 lines
1.4 KiB
Go
Raw Permalink Normal View History

2023-02-28 11:44:19 +00:00
package twentyseventeen
import (
"fmt"
2023-05-04 12:37:06 +00:00
"github.com/fthvgb1/wp-go/app/theme/wp"
2023-02-28 11:44:19 +00:00
)
2023-03-01 05:17:12 +00:00
func customHeader(h *wp.Handle) (r string) {
2023-02-28 15:38:23 +00:00
themeMods := h.CommonThemeMods()
headerTextColor := themeMods.HeaderTextcolor
if headerTextColor == "" || headerTextColor == themeMods.ThemeSupport.CustomHeader.DefaultTextColor {
2023-02-28 11:44:19 +00:00
return
}
css := `
.site-title,
.site-description {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
}`
if headerTextColor != "blank" {
css = fmt.Sprintf(customHeaderCss, headerTextColor)
}
r = fmt.Sprintf(`<style id="twentyseventeen-custom-header-styles" type="text/css">%s</style>`, css)
return
}
var customHeaderCss = `
.site-title a,
.colors-dark .site-title a,
.colors-custom .site-title a,
body.has-header-image .site-title a,
body.has-header-video .site-title a,
body.has-header-image.colors-dark .site-title a,
body.has-header-video.colors-dark .site-title a,
body.has-header-image.colors-custom .site-title a,
body.has-header-video.colors-custom .site-title a,
.site-description,
.colors-dark .site-description,
.colors-custom .site-description,
body.has-header-image .site-description,
body.has-header-video .site-description,
body.has-header-image.colors-dark .site-description,
body.has-header-video.colors-dark .site-description,
body.has-header-image.colors-custom .site-description,
body.has-header-video.colors-custom .site-description {
color: #%s;
}
`