Page 1 of 1

Custom published date in CGBlog

Posted: Tue Dec 01, 2020 12:59 pm
by jakovbak
Hello everyone!
I have a question regarding CGBlog published date... I'd like to customize it's appearance but to do so, I need to do something like this:

Code: Select all

{if $entry->postdate}
	<div class="CGBlogSummaryPostdate latest-news-date pull-left mr45">
		<span class="date pull-left">{$smarty.now|date_format:"%d"}</span>
		<span class="month text-uppercase pull-left">{$smarty.now|date_format:"%B"}</span>
		<span class="year">{$smarty.now|date_format:"%Y"}</span>
	</div>
{/if}
Of course, this kind of date format shows today's date always... How can I force it to use each post's date of publishing?
Thank you in advance and keep safe!
jakovbak

Re: Custom published date in CGBlog

Posted: Tue Dec 01, 2020 5:28 pm
by DIGI3
Can you not just use $entry->postdate instead of $smarty.now? Or am I missing something?

Remember that you can use <pre>{$entry|print_r}</pre> in your templates to see what information is available.

Re: Custom published date in CGBlog

Posted: Tue Dec 01, 2020 6:42 pm
by jakovbak
I'm really not that good in smarty and maybe my explanation was not clear enough. On attached pic you can see what I'm trying to do (design of 'date posted') and the only way to do it - the only one I can think of :!: - is to break it in three parts: day, month, year. But I don't know how to extract it from blog's post.

Re: Custom published date in CGBlog

Posted: Tue Dec 01, 2020 6:49 pm
by DIGI3
In the sample you provided, replace $smarty.now with $entry->postdate

Re: Custom published date in CGBlog

Posted: Tue Dec 01, 2020 7:15 pm
by jakovbak
Thank you DIGI3, it works!!! ;D