wp-go/app/theme/theme.go

25 lines
578 B
Go
Raw Normal View History

2023-01-18 15:04:12 +00:00
package theme
import (
2023-05-04 12:37:06 +00:00
"github.com/fthvgb1/wp-go/app/pkg/config"
"github.com/fthvgb1/wp-go/app/theme/twentyfifteen"
"github.com/fthvgb1/wp-go/app/theme/twentyseventeen"
"github.com/fthvgb1/wp-go/app/wpconfig"
2023-01-18 15:04:12 +00:00
)
2023-02-14 11:47:47 +00:00
func InitTheme() {
2023-05-04 13:44:17 +00:00
AddThemeHookFunc(twentyfifteen.ThemeName, twentyfifteen.Hook)
AddThemeHookFunc(twentyseventeen.ThemeName, twentyseventeen.Hook)
2023-01-18 15:04:12 +00:00
}
2023-01-20 11:58:45 +00:00
2023-03-09 14:36:41 +00:00
func GetCurrentTemplateName() 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
}