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-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-03-01 14:52:05 +00:00
|
|
|
twentyseventeen.Init(TemplateFs)
|
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 == "" {
|
2023-02-20 17:07:32 +00:00
|
|
|
tmlp = wpconfig.GetOption("template")
|
2023-01-20 11:58:45 +00:00
|
|
|
}
|
|
|
|
if !IsTemplateDirExists(tmlp) {
|
|
|
|
tmlp = "twentyfifteen"
|
|
|
|
}
|
|
|
|
return tmlp
|
|
|
|
}
|