WordPress.org

Forums

TablePress
[resolved] Disable standard TablePress CSS (10 posts)

  1. jaap
    Member
    Posted 2 years ago #

    For those of you out here that don't like a standard CSS applied to your tables and rather use completely your own instead of first having to override the standard TablePress CSS, add this to your functions.php:

    add_filter('tablepress_use_default_css', false);

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    thanks for your post. Yes, disabling the Default CSS is possible via that filter. However, your code contains a small error. The correct usage is

    add_filter( 'tablepress_use_default_css', '__return_false' );

    Now, while this works, I really don't recommend doing this! The reason is that you will lose the styling for the advanced features, like the sorting arrows, but also things like the alternating row colors.
    It is much better to use the default CSS and just add some "Custom CSS" (for examples, see the plugin FAQ at http://tablepress.org/faq/ ) to overwrite the default CSS. This ensures that basic functionality will still work.

    Regards,
    Tobias

  3. Monika
    Member
    Posted 2 years ago #

    Hi TobiasBg
    this is a massive performance overkill
    if I use all css files from plugins,
    so I try to delete plugin css too and use my own. And I know how to style "even and odd" - and I can style arrows too ;)
    so thanks for this code "correction".

  4. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    I don't really see why this would be a "massive" performance overkill. There would be a few CSS declarations that would be loaded although they are not used, but that applies to so much code in the theme that this is not really a valid argument, in my opinion.
    Of course, if you know how to get back the features like alternating row colors and the sorting arrows, I won't stop you from using that hook to remove the default styling :-) Just be aware that you might not benefit from changes/fixes/new features in the CSS immediately.

    Regards,
    Tobias

  5. jaap
    Member
    Posted 2 years ago #

    Thanks for the code-correction. I don't think it's performance overkill, but this particular website runs a lot of plugins so I try to keeps things minimised and organised :-) But the average user indeed doensn't need this.

  6. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    no problem! Yes, in your and Monika's use cases, this if of course worthwhile to do then.

    Best wishes,
    Tobias

  7. Mikko Saari
    Member
    Posted 2 years ago #

    Ah, I was about to post and ask for this option to be added, but I should've known that you've already thought of it. Thanks.

    In my case, I've got a designer-made CSS styles for the tables, and the default styles are messing with them - easier just to disable all default styles instead of hunting down the offending bits and covering them.

    We use few of the advanced features anyway, just static tables (even for those, your plugin is a must-have - we have literally hundreds of tables on our sites and managing them without your plugin would be a pain).

  8. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    thanks for that feedback! :-) Good to hear that this option will be helpful for you!

    Best wishes,
    Tobias

  9. Heiko Mamerow
    Member
    Posted 2 years ago #

    Thank You for the info!

    Generally: Disabling the plugin-css is very important to reduce the number of http-requests. This is a important "to-do", if you pimp a website for speed-optimization...

    For this reason it is better to put all the plugin-css into the main css-file.

    Feature request to Tobias :-)
    Maybe you could give us in the future a general option to disable the css in Your (marvelous) plugin?

    Greetings from Berlin
    Heiko

  10. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your question, and sorry for the late answer. As I was on vacation, I didn't have a chance to reply earlier.

    Such an option already exists, namely a plugin filter hook, as described in my first reply in this thread :-)
    I will not add a checkbox for this though, as that would not be useful and would just confuse regular users.

    And I agree that reducing HTTP requests is a good thing, and as TablePress uses the WordPress script/style enqueuing functionality, this can easily be used by a minification plugin that combines all CSS file into one.

    Regards,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TablePress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags