cliff
7/4/2015 - 1:57 PM

make Restrict Content Pro wp-admin table column widths nicer

make Restrict Content Pro wp-admin table column widths nicer

<?php
// Condense information on Restrict Content Pro wp-admin tables (avoid "too tall" table rows)
// override .widefat * { word-wrap: break-word; } and table.fixed { table-layout: fixed; }
// RCP pages with tables: /wp-admin/admin.php?page= ... rcp-members, rcp-member-levels, rcp-discounts, rcp-payments, or rcp-logs
// there are some columns we may NOT want to make AUTO width: https://github.com/pippinsplugins/Restrict-Content-Pro/blob/master/includes/css/admin-styles.css#L31
add_action('admin_head','my_rcp_tables_not_too_tall');
function my_rcp_tables_not_too_tall() {
	$current_screen = get_current_screen();
	
	if( !is_object($current_screen) ) {
		return false;
	} else {
		if( false !== strpos( $current_screen->id, 'toplevel_page_rcp-members' )
			|| false !== strpos( $current_screen->id, 'restrict_page_rcp' ) ) {
			$output  = '<style>';
			$output .= 'table.fixed { table-layout: auto !important; }';
			$output .= ' table.wp-list-table th :not(.column-message) { width: auto !important; }';
			$output .= ' .widefat *, .widefat th, .widefat td { word-wrap: normal !important; }';
			$output .= '</style>';
			echo $output;
		}
	}
}