Browse Source

add modified col

windhamdavid 2 years ago
parent
commit
7b5305cc02
1 changed files with 32 additions and 0 deletions
  1. 32 0
      inc/tweaks.php

+ 32 - 0
inc/tweaks.php

@@ -1,5 +1,37 @@
 <?php
 
+
+######################  Date Modified	######################
+
+function daw_post_columns_data( $column, $post_id ) {
+	switch ( $column ) {
+	case 'modified':
+		$m_orig		= get_post_field( 'post_modified', $post_id, 'raw' );
+		$m_stamp	= strtotime( $m_orig );
+		$modified	= date('Y/m/d', $m_stamp );
+			$modr_id	= get_post_meta( $post_id, '_edit_last', true );
+			echo '<p class="mod-date">';
+			echo '<em>'.$modified.'</em>';
+			echo '</p>';
+		break;
+	}
+}
+add_action ( 'manage_posts_custom_column',	'daw_post_columns_data',	10,	2	);
+add_filter ( 'manage_edit-post_columns',	'daw_post_columns_display');
+
+function daw_post_columns_display( $columns ) {
+	$columns['modified']	= 'Last Modified';
+	return $columns;
+}
+function daw_last_modified_column_register_sortable( $columns ) {
+	$columns['modified'] = 'post_modified';
+  return $columns;
+}
+add_filter( "manage_edit-post_sortable_columns", "daw_last_modified_column_register_sortable" );
+add_filter( "manage_edit-page_sortable_columns", "daw_last_modified_column_register_sortable" );
+
+ 
+
 remove_action('wp_head', 'index_rel_link' );
 remove_action('wp_head', 'rel_canonical');
 remove_action('wp_head', 'start_post_rel_link', 10);