PDA

View Full Version : Post create date in showthread


vacancy33
07-08-2020, 08:45 AM
How can i show post create date in showthread template?

$post[postdate] is not work :/ Work for only postbit or postbit_legacy

I have a schema code;

<script type="application/ld+json">
{
"@context":"http://schema.org",
"@type":"DiscussionForumPosting",
"@id":"********",
"headline":"$thread[prefix_plain_html] $thread[title]<if condition='$pagenumber>1'> - <phrase 1='$pagenumber'>$vbphrase[page_x]</phrase></if>",
"articleSection":"$foruminfo[title_clean]",
"author":{"@type":"Person","name":"$thread[postusername]"},
"datePublished":"$post[postdate]", // this is not work in showthread template
"dateModified":"",
"image":"********************",
"interactionStatistic":{
"@type":"InteractionCounter",
"interactionType":"https://schema.org/ReplyAction",
"userInteractionCount":"$thread[replycount]"},
"publisher":{
"@type":"Organization",
"name":"***********",
"url":"**********",
"logo":{"@type":"ImageObject",
"url":"*******************"}
},
"mainEntityOfPage":{
"@type":"WebPage",
"@id":"***********"}
}
</script>

z3r0
07-09-2020, 07:11 AM
Which postdate do you want to show?

If it's the first you can create a plugin to do it.

Hook location:Showthread_complete
Title:thread start date
Code
$thread[startdate] = vbdate("Y-m-d", $thread["dateline"]);


$thread[startdate] (or {vb:raw thread.startdate} for vb4) will then be available in showthread.

Schema also accepts datetime format so you could use Y-m-dTH:i:sP in the plugin instead of Y-m-d for greater accuracy.

157670

z3r0
07-09-2020, 07:27 AM
After a little more playing, this will give you first and last post dates (you can use last for date modified)

$thread[startdate] = vbdate("Y-m-dTH:i:sP", $thread["dateline"]);
$thread[lastdate] = vbdate("Y-m-dTH:i:sP", $thread["lastpost"]);

vacancy33
07-09-2020, 09:16 AM
After a little more playing, this will give you first and last post dates (you can use last for date modified)

$thread[startdate] = vbdate("Y-m-dTH:i:sP", $thread["dateline"]);
$thread[lastdate] = vbdate("Y-m-dTH:i:sP", $thread["lastpost"]);

Thank you soo much it s work :)