Posts: 3,491
Threads: 106
Joined: Mar 2010
2011-06-16, 15:38:36
(This post was last modified: 2012-02-12, 20:35:11 by fotothink.)
[Update: Now available for download in Extend]
This plugin changes the behaviour of GetSimple's page date field (pubDate), making it fixed, working like a real publication date (it will not change when you edit and save a page again).
You can also edit the date under page Options. (Very basic editor, no date picker and it doesn't warn if date entered is invalid, e.g. "2010-09-31", or "aaaa" -- it would save it as the current time.)
This plugin also adds a new field, lastUpdate, that works like GS's default pubDate (last saved/modified). You can display it with function get_page_lastupdate(), that works like GS's get_page_date()
Posts: 2,094
Threads: 54
Joined: Jan 2011
Carlos Wrote:This plugin changes the behaviour of GetSimple's page date field (pubDate), making it fixed, working like a real publication date (it will not change when you edit and save a page again).
You can also edit the date under page Options. (Very basic editor, no date picker and it doesn't warn if date entered is invalid, e.g. "2010-09-31", or "aaaa" -- it would save it as the current time.)
You can define the editing date[-time] format in the plugin's file.
This plugin also adds a new field, lastUpdate, that works like GS's default pubDate (last saved/modified). You can display it with function get_page_lastupdate(), that works like GS's get_page_date()
pubDateFix 0.1 beta: http://www.cyberiada.org/cnb/getsimple-p...ubdatefix/
Nice functionality, but I'm not sure if changing the meaning of a field is the best way to do it.
The I18N Custom Fields plugin does it the other way: it leaves the pubDate as is and automatically adds a new field creDate with the creation date. Also the I18N search plugin allows sorting by pubDate and creDate (if it exists).
Posts: 3,491
Threads: 106
Joined: Mar 2010
I see your point, but I don't agree that it's changing the meaning of the field. "pubDate" is widely used (RSS, etc.) as a posted/publication date, not as a last saved one. And get_page_date()'s meaning is generic. However it's true that it's changing the expected behaviour for both for those who know GetSimple.
Before developing this plugin, I had experimented making a similar (easier) one, that I have not released: PublicDate. The editable field was publicDate, to be called by function get_page_publicdate().
However, I thought it could be more interesting to be able to directly use the -let's call it- publication date with GS's own get_page_date(). Also, I liked seeing the publication date instead of the last-modified one in the Page Management list, without having to patch /admin/pages.php
Another advantage was that pubDate is indexed automatically by Mike's PagesXML plugin and future GS 3.1, useful for doing things like my dirty would-be plugin "Recent Pages".
Thanks a lot for your opinion. (What about others...?)
I may try to do something similar using creDate (I knew about that)... Though perhaps the best would be that GetSimple's core had a creation/publication date (like creDate -- no need to be editable, that can be done with plugins).
Posts: 4
Threads: 0
Joined: Jun 2012
Simple and good plugin, thanks
Posts: 328
Threads: 5
Joined: May 2012
Would you mind providing an example of what would be placed in the template?
Apparently my brain is not working today :/
Something like:
Code: <p>Updated on: <?php get_page_lastupdate($dateformat); ?> </p>
Posts: 3,491
Threads: 106
Joined: Mar 2010
Replace $dateformat by a string using the same format as GS's get_page_date(), e.g.:
Code: <?php get_page_lastupdate('Y-m-d'); ?>
Code: <?php get_page_lastupdate('F jS, Y - g:i A'); ?>
Posts: 328
Threads: 5
Joined: May 2012
Gracias Carlos,
I new my brain wasnt working right.
Is it possible to have both a published date and an updated date, or does this replace the published date?
Posts: 3,491
Threads: 106
Joined: Mar 2010
This plugin adds a new field, lastUpdate, that works like GS's pubDate did without the plugin (its value is changed everytime you re-save the page).
Use get_page_date() to echo the publication/post/public date, and get_page_lastupdate() to echo the last saved/updated date.
Posts: 328
Threads: 5
Joined: May 2012
This doesn't seem to be working properly for me.
I have in the template now:
Code: <p>Published on <time datetime="<?php get_page_date('Y-m-d'); ?>" pubdate><?php get_page_date('F jS, Y'); ?></time><br>
Edited on <?php get_page_lastupdate('F jS, Y - g:i A'); ?></p>
In "data/pages/index.xml" I can see:
Code: <pubDate>Wed, 02 Sep 2009 03:35:00 +0200</pubDate><lastUpdate>Sun, 28 Oct 2012 20:50:41 +0100</lastUpdate>
But on the page its self it only displays pubDate for both areas.
Posts: 3,491
Threads: 106
Joined: Mar 2010
2012-10-29, 06:13:55
(This post was last modified: 2012-10-29, 06:20:07 by fotothink.)
Ah yes. Will fix it, thanks for reporting.
[update] Edit pubdatefix.php line 51, change
Code: if (isset($data_edit->lastUpdate)) {
by:
Code: if (isset($data_index->lastUpdate)) {
Posts: 328
Threads: 5
Joined: May 2012
Thanks for the update, all is working properly now.
Posts: 3,491
Threads: 106
Joined: Mar 2010
PubDate Fix, version 0.2: - Functions get_page_lastupdate and return_page_lastupdate were not working as they should. (thanks @islander)
Posts: 3,491
Threads: 106
Joined: Mar 2010
PubDate Fix, version 0.3: - Date/time picker (for GS 3.1+) (jquery datetimepicker)
- Field layout adapted for GS 3.0+ (this plugin was designed for GS 2.03)
- Field label ("Publication Date") translated to many languages (i18n files included)
|