wp-go/internal/theme/theme.go

26 lines
623 B
Go
Raw Permalink Normal View History

2023-01-18 15:04:12 +00:00
package theme
import (
2023-01-20 11:58:45 +00:00
"github.com/fthvgb1/wp-go/internal/pkg/config"
2023-02-09 09:12:33 +00:00
"github.com/fthvgb1/wp-go/internal/theme/twentyfifteen"
2023-01-18 15:04:12 +00:00
"github.com/fthvgb1/wp-go/internal/theme/twentyseventeen"
2023-01-20 11:58:45 +00:00
"github.com/fthvgb1/wp-go/internal/wpconfig"
2023-01-18 15:04:12 +00:00
)
2023-02-14 11:47:47 +00:00
func InitTheme() {
2023-02-09 09:12:33 +00:00
addThemeHookFunc(twentyfifteen.ThemeName, twentyfifteen.Hook)
2023-02-18 15:35:39 +00:00
twentyfifteen.Init(TemplateFs)
2023-01-26 17:03:41 +00:00
addThemeHookFunc(twentyseventeen.ThemeName, twentyseventeen.Hook)
2023-01-18 15:04:12 +00:00
}
2023-01-20 11:58:45 +00:00
func GetTemplateName() string {
2023-02-05 13:06:04 +00:00
tmlp := config.GetConfig().Theme
2023-01-20 11:58:45 +00:00
if tmlp == "" {
tmlp = wpconfig.GetOption("template")
2023-01-20 11:58:45 +00:00
}
if !IsTemplateDirExists(tmlp) {
tmlp = "twentyfifteen"
}
return tmlp
}