I have one page in my WordPress site with a table that needs to be super compact and simple

The theme our site was built with makes the tables look huge and that's fine for almost all of the site but we have one page with an 25-row table that needs to be super compact and simple so it fits in less than one page. Is there a way to tell Wordpress to ignore all themes and table styles for just one section of the site?

Also, this may only be relevant to some answers but the table is built and populated by a JS script which is imported into the page by a plugin (Scripts n Styles).

Solutions

The other possibility is that you need to add CSS '@media' rules to 'adjust' the CSS for smaller screens. Theme's that are 'responsive' do this.

But setting up a unique class name for your table, then adding CSS for that class name is a quick way to go. (As @GoTeamScotch said in Option 2 of their answer.)

Not sure how comfortable you are with programming and such, but in general I would assume that your theme doesn't let you pick and choose where the table styles get loaded, so the only way to do it would be to disable it from loading the stylesheet that styles the table in question OR insert a new stylesheet that has basic table styles that is designed to only affect that one table.

Option 1 - Disable stylesheet:

Is there a way to tell Wordpress to ignore all themes and table styles for just one section of the site?

You can disable certain CSS stylesheets from loading on specific pages, so if by "sections" you mean "pages" then yes. If you have other tables on that same page that need to keep the existing styles, then it gets more complicated.

IF you want to stop a stylesheet from loading on a specific page, you could do something like this:

add_action( 'wp_enqueue_scripts', 'stkxchg301761_remove_css' );
function stkxchg301761_remove_css() {
    if (is_single('SomePageHere')) {
        wp_dequeue_style('StyleHandleHere');
    }
}

This would go in your theme's functions.php file.

Replace 'SomePageHere' with the slug of the page you're trying to remove the CSS sheet from. Replace 'StyleHandleHere' with the handle of the script you're trying to prevent from loading.

If you don't know the handle to the script, you can find it by using

var_dump($GLOABLS['wp_styles']); die;

You can put that^ in the same spot as the first code I provided, replacing the "wp_dequeue_style" line. This will make your site spit out all of the styles that are being loaded on that page. Look for the offending stylesheet and it's handle should be shown right next to it.

Option 2 - Add a new stylesheet

The simpler option would probably be to just load a new stylesheet on top of what's already there and have it only affect that one table. That would require you to make a new simple stylesheet, then load it only on that specific page. The stylesheet would contain styles that target that specific table. You can use the same code I provided at the top, except replace the "wp_dequeue_style" line with

wp_enqueue_style('my-custom-stylesheet', 'PathToStylesheet');

Replace 'PathToStylesheet' with the URL to the new stylesheet on your server.

The stylesheet should then have rules that target your table.

Similar questions

MySQL Query: Getting COUNT of one table where the ID of table 1 has a value of X in a different table
I am working with Wordpress creating a filter and am struggling to figure out this raw query. This is what I have now: But I also need to check the wp_postmeta table to see if a row that has a matching post_id has the meta_key of wpcf-active and the meta_value of 1.
Moving a wp multisite to new host - The domain name will be changed but the current one needs to stay as well
I have a WordPress multi site, 1 main domain and 21 additional domains on it. Now I am changing host, Currently I am on just host and moving to go daddy, on go daddy I have a new domain which I want to make the main domain and want to make these 22 domains like sub-domains on it. A more clearer example here Site = Abc.com 21 additional domains = ab...
please how to convert this type of table to a simple php table
please how to convert this type of table to a simple php table this table is in the wp_option when i insert a php array into an option please who can help me? Thanks
Can i have a single wordpress site to have two themes ( one for pc other for mobiles)
I have a wordpress site say at www.demo.com, now I have two themes one which I want to use this user is acessing the site from "PC" (computer) and a another theme, which is a full fledged mobile theme to be used only when the user is accessing from a mobile device ( such as an android phone, iphone, ipad or tablet). I did some googling and found th...
Site needs massive upgrade - how to proceed?
I have a former customer who, contrary to my recommendations, has not stayed on top of their WP upgrades. They now need to make the leap from 3.5.1 to 4.1.1 (or whatever is current at the moment). They used a fairly vanilla theme (might have even been Twenty Eleven), and not used too many plugins. I have found numerous threads (here and elsewhere) ...
What are PHP extensions and libraries WP needs and/or uses?
Codex loosely only mentions PHP version in server requirements, however PHP can be configured in pretty wide range of excluding/including different parts. What are extensions/libraries that:

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.