Show "Last Updated" in ticket meta data (5 posts)

  1. croakingtoad
    Posted 5 years ago #

    When you're viewing the list of tickets, there's lots of great data:

    * Ticket #32
    * Category BRC
    * Milestone 100%
    * Tags —
    * Created 13 mins ago

    It'd be nice to have it show a "Last updated" column as well. Is that possible and if so, how? :)

  2. Spencer Finnell
    Posted 5 years ago #

    I originally had that implemented in, but it required quite a few more database queries.

    What I did was use get_comments to get the latest comment for the post; then I would find out the date of that comment, and list it.

    So if you want to implement that, create a Child Theme, and a file called ticket-meta.php. Copy and paste the contents of ticket-meta.php of the theme, and then add the extra item of last updated.

    Let me know if you need more help.

  3. croakingtoad
    Posted 5 years ago #

    Okay, I got it working, thanks. I'm not very adept at shortcode but here's what I came up with.

    	<small><?php _e( 'Created', 'quality' ); ?></small>
    	<?php echo(date('m/d/Y',strtotime(get_the_date()))); ?>
    	<small><?php _e( 'Last Updated', 'quality' ); ?></small>
    		$comment_data = get_comments("number=1&post_id=$post->ID");
    		foreach ($comment_data as $comm) : echo(date('m/d/Y G:i',strtotime($comm->comment_date))); endforeach;
  4. Spencer Finnell
    Posted 5 years ago #

    Cool, that's what I used before.

    If you want to have the difference of time "3 days ago" or something, check out the WordPress function, human_time_diff

  5. croakingtoad
    Posted 5 years ago #


    Since the people who report on my activities, etc. want real dates, I'm gonna take it easy on them and not make them do math. :)

    Cheers for a fantastic theme.

    Check out my latest plugin - http://wordpress.org/extend/plugins/stardate/


Topic Closed

This topic has been closed to new replies.

About this Topic