Support » Plugins » [Plugin: WP-Table Reloaded] Load Table CSS only on table pages

  • I only use WP-Table-Reloaded on three of my WordPress pages, yet the table CSS is called on every page of my site. Is there any way to halt this and only select which pages to call the plugins CSS, similar to what cforms allows?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    currently there is no way of achieving this integrated in the plugin, as there is no reliable possibility to detect in the head of the page (where the CSS needs to be printed), whether there is a table shown on the page.

    There is a little workaround however
    You could manually add the CSS to the header.php of your theme, surrounded by a check on whether the page/post slug is in a list of pages/post slugs from which you know that they contain a table.
    In that case, you can disable the checkboxes for automatic inclusion of the CSS on the “Plugin Options” screen.

    Here is some example code (untested):

    if ( is_single( array( 'page-1', 'page-2', 'post-1' ) ) ) {
    ... the actual CSS code...

    Actually I would not worry too much though. Another possibility might be to just add the CSS to your theme’s style.css and minify that. That way your CSS is even shorter and the table CSS would be part of the caching.

    Hope this helps!

    Best wishes,

    Hey Tobias,

    Thanks for the rather insightful reply! What I plan on doing is manually adding the plugin.css and tablesorter.css data to my theme’s style.css file and then minifying it.

    If I could make a suggestion, maybe in a future version you could put a field in the admin panel where we could input the ID(s) of a page and then the plugin’s stylesheet would only load on those pages. That’s the way cforms does it and it gets around the problem of detection it’s left up to the admin. It’s not foolproof, as the admin has to remember to add each page’s ID when he or she adds a new table, but it works well for those of us who don’t use many tables =)



    thanks for that suggestion! I’m not too eagerly a fan of even more input fields on the admin screens, but it could be a solution for the future.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP-Table Reloaded] Load Table CSS only on table pages’ is closed to new replies.