Pippin always does a great job using WordPress core functionality and styling — and his Restrict Content Pro (RCP) plugin is no exception — but one of the issues with the wp-admin tables (e.g. for displaying members) is the fixed column widths and word-wrapping.
Example
Here’s an example comparison.
These 2 screenshots are from the same browser window width. I did not resize the browser window. They’re from a 27″ iMac with a decently-wide browser window (not full screen, not small width). The only difference is the code below being implemented.
Before / Default Display:
1,156 pixels wide and narrower — Ouch!
This is what we want to fix!
1,294 pixels and wider — No problem.
No problems at this wide width.
After / Better Display:
950 pixels wide — Fixed!
Ah, much better! Even works on much narrower screens.
1,294 pixels wide — Still looks good.
Code
Add this code to your active child theme’s functions.php or your own functionality plugin to fix all the wp-admin tables for Restrict Content Pro (RCP). It even keeps the forced 175px width on the Subscription Levels’ “Description” column.
<?php
// Condense information on Restrict Content Pro wp-admin tables (avoid "too tall" table rows)
// 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
If you want to review the other RCP columns that have custom fixed widths (so you can add additional CSS :not() selectors to Line 17 of the code above to meet your preferences), check out RCP /includes/css/admin-styles.css#L31 (line number link is subject to change with plugin updates).
Fixing Restrict Content Pro’s wp-admin column widths
Pippin always does a great job using WordPress core functionality and styling — and his Restrict Content Pro (RCP) plugin is no exception — but one of the issues with the wp-admin tables (e.g. for displaying members) is the fixed column widths and word-wrapping.
Example
Here’s an example comparison.
These 2 screenshots are from the same browser window width. I did not resize the browser window. They’re from a 27″ iMac with a decently-wide browser window (not full screen, not small width). The only difference is the code below being implemented.
Before / Default Display:
1,156 pixels wide and narrower — Ouch!
This is what we want to fix!
1,294 pixels and wider — No problem.
No problems at this wide width.
After / Better Display:
950 pixels wide — Fixed!
Ah, much better! Even works on much narrower screens.
1,294 pixels wide — Still looks good.
Code
Add this code to your active child theme’s functions.php or your own functionality plugin to fix all the wp-admin tables for Restrict Content Pro (RCP). It even keeps the forced 175px width on the Subscription Levels’ “Description” column.
rcp-wp-admin-table-widths.php
hosted with ❤ by GitHub
If you want to review the other RCP columns that have custom fixed widths (so you can add additional CSS :not() selectors to Line 17 of the code above to meet your preferences), check out RCP /includes/css/admin-styles.css#L31 (line number link is subject to change with plugin updates).
Related: WordPress trac: Set width to auto for list table headers