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-14 11:47:47 +00:00
|
|
|
"github.com/fthvgb1/wp-go/internal/theme/common"
|
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-01-26 17:03:41 +00:00
|
|
|
addThemeHookFunc(twentyseventeen.ThemeName, twentyseventeen.Hook)
|
2023-02-14 11:47:47 +00:00
|
|
|
common.AddThemeSupport(twentyfifteen.ThemeName, twentyfifteen.ThemeSupport())
|
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.Options.Value("template")
|
|
|
|
}
|
|
|
|
if !IsTemplateDirExists(tmlp) {
|
|
|
|
tmlp = "twentyfifteen"
|
|
|
|
}
|
|
|
|
return tmlp
|
|
|
|
}
|