diff --git a/internal/theme/twentyfifteen/posts/detail.gohtml b/internal/theme/twentyfifteen/posts/detail.gohtml
index 10417a4..3c60d74 100644
--- a/internal/theme/twentyfifteen/posts/detail.gohtml
+++ b/internal/theme/twentyfifteen/posts/detail.gohtml
@@ -5,6 +5,11 @@
+ {{if .post.Thumbnail.Path }}
+
+
+
+ {{end}}
diff --git a/internal/theme/twentyfifteen/twentyfifteen.go b/internal/theme/twentyfifteen/twentyfifteen.go
index c0a0ffa..372dd4a 100644
--- a/internal/theme/twentyfifteen/twentyfifteen.go
+++ b/internal/theme/twentyfifteen/twentyfifteen.go
@@ -12,6 +12,7 @@ import (
"github.com/fthvgb1/wp-go/internal/theme/wp"
"github.com/fthvgb1/wp-go/internal/theme/wp/components"
"github.com/fthvgb1/wp-go/internal/theme/wp/components/widget"
+ "github.com/fthvgb1/wp-go/internal/wpconfig"
"strings"
)
@@ -76,4 +77,11 @@ func configs(h *wp.Handle) {
h.PushHandleFn(constraints.AllStats, wp.NewHandleFn(customHeader, 10))
h.PushHandleFn(constraints.AllStats, wp.NewHandleFn(wp.IndexRender, 50))
h.PushHandleFn(constraints.Detail, wp.NewHandleFn(wp.DetailRender, 50))
+ h.PushHandleFn(constraints.Detail, wp.NewHandleFn(postThumb, 60))
+}
+
+func postThumb(h *wp.Handle) {
+ if h.Detail.Post.Thumbnail.Path != "" {
+ h.Detail.Post.Thumbnail = wpconfig.Thumbnail(h.Detail.Post.Thumbnail.OriginAttachmentData, "post-thumbnail", "")
+ }
}
diff --git a/internal/theme/wp/calclass.go b/internal/theme/wp/calclass.go
index b974e64..03f20e5 100644
--- a/internal/theme/wp/calclass.go
+++ b/internal/theme/wp/calclass.go
@@ -110,12 +110,10 @@ func TermClass(term models.TermsMy) string {
termClass = strconv.FormatUint(term.TermTaxonomy.TermId, 10)
}
switch term.Taxonomy {
- case "category":
- return str.Join("category-", termClass)
case "post_tag":
return str.Join("tag-", termClass)
case "post_format":
return fmt.Sprintf("format-%s", strings.ReplaceAll(term.Slug, "post-format-", ""))
}
- return fmt.Sprintf("%s-%d", term.Taxonomy, term.TermTaxonomy.TermId)
+ return str.Join(term.Taxonomy, "-", termClass)
}
diff --git a/internal/theme/wp/detail.go b/internal/theme/wp/detail.go
index b147dd9..64fa5cc 100644
--- a/internal/theme/wp/detail.go
+++ b/internal/theme/wp/detail.go
@@ -66,7 +66,6 @@ func (d *DetailHandle) PasswordProject() {
if d.password != d.Post.PostPassword {
wpposts.PasswdProjectContent(&d.Post)
}
- d.ginH["post"] = d.Post
}
}
func (d *DetailHandle) Comment() {
diff --git a/internal/wpconfig/thememods.go b/internal/wpconfig/thememods.go
index 0afbda9..a4f4067 100644
--- a/internal/wpconfig/thememods.go
+++ b/internal/wpconfig/thememods.go
@@ -82,8 +82,8 @@ func Thumbnail(metadata models.WpAttachmentMetadata, Type, host string, except .
FileSize: metadata.FileSize,
}
}
- if _, ok := metadata.Sizes[Type]; ok {
- r.Path = fmt.Sprintf("%s/wp-content/uploads/%s", host, metadata.File)
+ if siz, ok := metadata.Sizes[Type]; ok {
+ r.Path = fmt.Sprintf("%s/wp-content/uploads/%s", host, strings.ReplaceAll(metadata.File, filepath.Base(metadata.File), siz.File))
r.Width = metadata.Sizes[Type].Width
r.Height = metadata.Sizes[Type].Height