- Posts: 9
COMMUNITY FORUM
how to display published date instead of created
- Tomek
- Topic Author
- Offline
- New Member
I am looking for solution how to set K2 to show published date insted of created in category items view.
I can't find this value in K2 configuration
Please Log in or Create an account to join the conversation.
- Yorb
- Offline
- New Member
- Posts: 10
If you don't already have a template override you're working on, you can just duplicate the file from /components/com_k2/templates/default/category_item.php to /templates/<your template>/html/com_k2/default/ (create any directories that don't exist). Full instructions here: getk2.org/documentation/tutorials/item/174-templating-with-k2-and-the-concepts-of-sub-templates
Then, look for this code, it's at line 27 in mine:
Log in or Create an account to join the conversation.
- Tomek
- Topic Author
- Offline
- New Member
- Posts: 9
It's work fine
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
- Posts: 3722
Please Log in or Create an account to join the conversation.
- Yorb
- Offline
- New Member
- Posts: 10
William White wrote: @Darwin - The new k2 table item has 36 columns. I havent tested it but i think we can assume that the entire record gets into the $this->item array and could be addressed with ->columname. Have you tested that>?
I'm not sure exactly what you mean, but yes it looks like the whole db record for the item (including columns like publish_up) are accessible from $this->item, which is where I came up with my suggestion for Tomek. I tested briefly in my J! 1.5.25 / K2 2.5.4 install, and it seemed to work fine.
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
- Posts: 3722
Please Log in or Create an account to join the conversation.
- matt
- Offline
- New Member
- Posts: 2
Such and important feature... I don't know why you can't choose it in the GUI... alas, it's only the 9th custom line in my template override...
Also... this thread can be found on google... but can't be searched out in the forum... IMO the display date should default to the Publish Date, not the create date... you're displaying when it found it's way to the web, who cares when it was "created"... SOOO important for loading batches of articles you want to drip publish but just as applicable to those who save articles as drafts, leave unpublished, and finish later...
Please Log in or Create an account to join the conversation.
- Bevan
- Offline
- New Member
- Posts: 12
I am trying to do an Events site and having the items display based on the day they actually happen (Finish publishing date) would be tops!!!
thanks
Bevan
Please Log in or Create an account to join the conversation.
- Bevan
- Offline
- New Member
- Posts: 12
Please Log in or Create an account to join the conversation.
- Yiota
- Visitor
<?php echo JHTML::_('date', $this->item->publish_down, JText::_('K2_DATE_FORMAT_LC2')); ?>
Please Log in or Create an account to join the conversation.