Add comment date to comments
WP-CRM System uses WordPress comment system on all records. To add the comment’s date to the comment in the edit screen, you will need to use a bit of custom code.
These are two examples of how to add the date before and after the comment text:
// Comment date after comment text add_filter( 'comment_text', 'show_comment_date_after_comment' ); function show_comment_date_after_comment( $comment_text ) { $comment_text .= '<br />' . get_comment_date(); return $comment_text; } // Comment date before comment text add_filter( 'comment_text', 'show_comment_date_before_comment' ); function show_comment_date_before_comment( $comment_text ) { $comment_date = get_comment_date(); $comment_text = $comment_date . '<br />' . $comment_text; return $comment_text; }
Use only one of those code blocks as appropriate. Place it in your theme’s functions.php file or in a custom plugin. Also, please note that this will add the comment’s date to all comments on your site, including posts and other custom post types. To only use this on WP-CRM System entries, you would need to wrap that code in a conditional statement like this:
// Comment date before comment text only for WP-CRM System add_filter( 'comment_text', 'show_comment_date_before_comment_wp_crm_system_only' ); function show_comment_date_before_comment_wp_crm_system_only( $comment_text ) { if ( in_array( get_post_type( get_the_ID() ), array( 'wpcrm-organization', 'wpcrm-contact', 'wpcrm-project', 'wpcrm-task', 'wpcrm-opportunity', 'wpcrm-campaign' ) ) { $comment_date = get_comment_date(); $comment_text = $comment_date . '<br />' . $comment_text; } return $comment_text; }