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 {
|
2024-01-23 14:59:15 +00:00
|
|
|
templateName := config.GetConfig().Theme
|
|
|
|
if templateName == "" {
|
|
|
|
templateName = wpconfig.GetOption("template")
|
2023-01-20 11:58:45 +00:00
|
|
|
}
|
2024-01-23 14:59:15 +00:00
|
|
|
if !IsTemplateDirExists(templateName) {
|
|
|
|
templateName = "twentyfifteen"
|
2023-01-20 11:58:45 +00:00
|
|
|
}
|
2024-01-23 14:59:15 +00:00
|
|
|
return templateName
|
2023-01-20 11:58:45 +00:00
|
|
|
}
|