Forum
Blog post meta information
In my post.php after the call for the blog post I have a call for an author template that looks like this:
<div class="module author">
<perch:if exists="author_image">
<img src="<perch:blog id="author_image" type="image" label="Image" width="240" height="240" crop="true" density="2" order="5" />" width="120" height="120" alt="<perch:blog id="authorGivenName" type="text" label="Given name" order="1" /> <perch:blog id="authorFamilyName" type="text" label="Given name" order="2" />" />
</perch:if>
<div class="hcard">
<pclass="fn n">This post was written by <a href="/blog/archive.php?author=<perch:blog id="authorSlug" type="text" />"><perch:blog id="authorGivenName" type="text" label="Given name" order="1" /> <perch:blog id="authorFamilyName" type="text" label="Given name" order="2" /></a> on <perch:blog id="postDateTime" format="%d %B %Y" /> in <?php perch_blog_section(perch_get('section')); ?> and tagged <?php perch_blog_post_tags(perch_get('s')); ?>.</p>
</div>
</div>
It correctly displays the post author and their photo, but is not showing the date, section name or the tags for the post. I don't really understand why, hoping someone can help me please.
Thanks.
I just realised I was trying to use php inside of a html template. I've corrected the tags one (not sure how to do the section one) but it doesn't actually display any tags (yes they are there).
Which page function are you using to display this template?
I'm using this
perch_blog_author_for_post()
will give you the author, but not the post.So what is the best way to call that template?
It was initially just calling the author, but I realised I needed to include the other information in that template. I'm not a php person, I do html & css fine, so I would appreciate any guidance please.
I think you should have all that available in the main post template - there may be no reason for splitting it into two.
Thanks Drew, I've reverted back to the original post.html and have the date and author working. The only thing I don't seem to be able to get to work is to display the tags or the blog section. I've tried to use the contents of
post_tag_link.html
inside post.html but it doesn't seem to display the tags.I imagine it's very simple, I'm just over thinking things.
Does
<perch:showall />
list your tags?Yes, that shows the tags under postTags.
So does this work?
It does, thank you! I knew it would be simpler than I was trying to make it.