WordPress.org

Ready to get started?Download WordPress

Forums

Latest Custom Post Type Updates
bug: show post published date vs. modified date (4 posts)

  1. Jonathan Lahijani
    Member
    Posted 1 year ago #

    I noticed a small bug under the "advanced settings" section of a widget using this plugin.

    The "Show Post" dropdown has two options:
    - published date
    - modified date

    No matter which one you choose, it will still show the modified date.

    I traced this to line 211 of the plugin's index.php file. I'm guessing the fact that even though you chose 'published date' is not respected in the code for some reason, thereby displaying the modified date.

    Thank you.

    http://wordpress.org/extend/plugins/latest-custom-post-type-updates/

  2. sv3
    Member
    Posted 1 year ago #

    Have you found a fix for this?

  3. Networkoilgas
    Member
    Posted 11 months ago #

    I too am interested in a fix for this. All my posts were added at the same date, then modified back to replace the original post dates from the previous website. The widget now only displays the added date.

    How can I retrieve the modified date? WordPress reads out the modified date but not the plugin widget. =(

    Thanks for your help!

  4. TimBHowe
    Member
    Posted 10 months ago #

    Hello,
    I ran into the same issue. Jonathan Lahijani was correct the issue is on line 211 of the plugin's index.php file. It reads

    echo '<span class="post-date">'.date($format.(($instance['show_time'] == 'yes')?', '.get_option('time_format'):''), strtotime(($instance['date_to_show'] == 'publish')?$lcptu->post->post_date:$lcptu->post->post_modified)).'</span>';

    It is basicly checking if the $instance['date_to_show'] is set to or equals 'publish' then show the publish date, if not so the last modified date. The issue with this line is the $instance['date_to_show'] option is never saved in the database as is it missing from the widgets function update($new_instance, $old_instance).

    To fix this add the following link just below line 50 in the index.php file:

    $instance['date_to_show'] = ($new_instance['date_to_show'] == 'publish')?'publish':'modified';

    This will properly save the option and the the date_to_show check will have something to test.

    Hope to see this in the next release. If you have any questions just post back to this thread.
    Thanks
    Tim

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.