WordPress.org

Support

Support » Themes and Templates » Show "Last Updated" in ticket meta data

Show "Last Updated" in ticket meta data

  • croakingtoad
    Member

    @croakingtoad

    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? 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • Spencer Finnell
    Member

    @spencerfinnell

    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.

    croakingtoad
    Member

    @croakingtoad

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

    <li>
    	<small><?php _e( 'Created', 'quality' ); ?></small>
    	<?php echo(date('m/d/Y',strtotime(get_the_date()))); ?>
    </li>
    
    <li>
    	<small><?php _e( 'Last Updated', 'quality' ); ?></small>
        <?php
    		$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;
    	?>
    </li>
    Spencer Finnell
    Member

    @spencerfinnell

    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

    croakingtoad
    Member

    @croakingtoad

    Awesomesauce.

    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/

    🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show "Last Updated" in ticket meta data’ is closed to new replies.