Variations
{[ 3 | .last-comments(1) | .comment-template | .show-comments(2) ]} | (i-1) |
Notice that it was only for my testing / presentation convenience that I used the implicit current post for all the custom fields in (i-1), but it would be easier to put all reusable custom fields into one post which you can later refer to from any injection.
Using another post as a custom field repository
You could gather all those custom fields into a post with a ´comments´ slug, slightly improve their name, and always use (i-2) from any post.
{[ 3 | @comments.last(1) | @comments.basic-template | @comments.show(2) ]} | (i-2) |
You could then add a different template to that ´comments´ post, and use (i-3).
{[ 5 | @comments.last(1) | @comments.special-template | @comments.show(2) ]} | (i-3) |
Using an author profile as a custom field repository
An equally valid alternative could be to add those custom fields to your own WordPress user profile, so that from your posts you can use (i-4).
{[ 3 | /author.comments-last(1) | /author.comments-special-template | /author.comments-show(2) ]} | (i-4) |
Mixing repository types as you see fit
The ideas behind the previous examples could also be mixed into one injection. For example, (i-5) could be used to let authors personalize templates.
{[ 5 | @comments.last(1) | /author.comments-template | @comments.show(2) ]} | (i-5) |
|
|
Nzymes | WordPress Plugin |
© 2015 by Andrea Ercolino |