Created
July 4, 2015 13:57
-
-
Save cliffordp/e3eb7f527d0c531c4aac to your computer and use it in GitHub Desktop.
make Restrict Content Pro wp-admin table column widths nicer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment