Highlight Your Own Posts in Admin Lists
Gives rows you authored a subtle colored edge in admin post lists, so on busy multi-author sites you can spot your own work at a glance.
Opens WPIDE on
Code
// Edge color for your rows.
$wpide_my_rows_color = '#2271b1';
add_filter( 'post_class', function ( $classes, $class, $post_id ) {
if ( is_admin() && (int) get_post_field( 'post_author', $post_id ) === get_current_user_id() ) {
$classes[] = 'wpide-mine';
}
return $classes;
}, 10, 3 );
add_action( 'admin_head-edit.php', function () use ( $wpide_my_rows_color ) {
printf( '<style>.wp-list-table tr.wpide-mine th.check-column{box-shadow:inset 4px 0 0 %s}</style>', esc_attr( $wpide_my_rows_color ) );
} );
Notes
Change $wpide_my_rows_color to match your admin color scheme.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.