Keyword

how to display published date instead of created

More
12 years 8 months ago #61488 by Tomek
Hello
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.

More
12 years 8 months ago #61489 by Yorb
Weird, I don't know why K2 doesn't give that option. This extension is limited in the weirdest ways. At any rate, you can do it with template overrides pretty easily.

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.

More
12 years 8 months ago #61490 by Tomek
thank you
It's work fine

Please Log in or Create an account to join the conversation.

More
12 years 8 months ago #61491 by william white
Replied by william white on topic Re: how to display published date instead of created
@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>?

Please Log in or Create an account to join the conversation.

More
12 years 8 months ago #61492 by Yorb
Having hella problems with this forum, first it tried to create my reply as a new topic, so I had to delete it, then it wouldn't let me post this because it was a 'duplicate post'. I don't know what forum module you guys are using, but it should probably die. :D Anyway, see my response below.

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.

More
12 years 8 months ago #61493 by william white
Replied by william white on topic Re: how to display published date instead of created
To the best of my knowledge the forum is Kenuna. We are currently doing out best to kill the spammers, but they are sorta like fire ants:)

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #61494 by matt
THANK YOU FOR THIS!!!

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.

More
11 years 20 hours ago #61495 by Bevan
Hi, is this doable using the 'Finish publishing' date?

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.

More
10 years 8 months ago #61496 by Bevan
Anyone know if it's doable? View by expiry date?

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #61497 by Yiota
Try with this:

<?php echo JHTML::_('date', $this->item->publish_down, JText::_('K2_DATE_FORMAT_LC2')); ?>

Please Log in or Create an account to join the conversation.