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() {
|
2024-08-31 12:01:52 +00:00
|
|
|
AddTheme(twentyfifteen.ThemeName, twentyfifteen.Hook)
|
|
|
|
AddTheme(twentyseventeen.ThemeName, twentyseventeen.Hook)
|
2023-01-18 15:04:12 +00:00
|
|
|
}
|
2023-01-20 11:58:45 +00:00
|
|
|
|
2024-08-31 12:01:52 +00:00
|
|
|
func GetCurrentTheme() string {
|
|
|
|
themeName := config.GetConfig().Theme
|
|
|
|
if themeName == "" {
|
|
|
|
themeName = wpconfig.GetOption("template")
|
2023-01-20 11:58:45 +00:00
|
|
|
}
|
2024-08-31 12:01:52 +00:00
|
|
|
if !IsTemplateDirExists(themeName) {
|
|
|
|
themeName = "twentyfifteen"
|
2023-01-20 11:58:45 +00:00
|
|
|
}
|
2024-08-31 12:01:52 +00:00
|
|
|
return themeName
|
2023-01-20 11:58:45 +00:00
|
|
|
}
|