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

    I’m not sure what exactly you are trying to achieve.
    Can you explain a little bit more in detail, please? Maybe with an example?

    Thanks!
    Tobias

    Thread Starter johnflufin

    (@johnflufin)

    By default you can only apply custom styles to a subset of tables by using their id dependent css class. For example:

    .wp-table-reloaded-id-7, wp-table-reloaded-id-12 {
        ...custom css...
    }

    This method requires the style sheet to be edited everytime a new table is added to the subset. It would be far more convenient to customize a subset of tables if there was a way to assign a custom css class on an individual basis. For example:

    <table>...
    <table class="group1">...
    <table class="group1">...
    <table>...
    <table class="group2">...
    <table class="group2">...

    Does your plugin allow this?

    Thread Starter johnflufin

    (@johnflufin)

    Actually .type1 and .type2 are probably better class names (rather than .group1 and .group2) but I hope you get the idea.

    Hi,

    thanks for that detailed explanation.
    Now I understand what you are talking about 🙂

    Unfortunately, currently that is not easily possible with the plugin, but I have something like that on my feature request list already, and will be working on it for a future version (I have a table templating system in mind, where you can select a template (or group or type) for a table, so that that will be used for the CSS styling.
    I did not yet have the time to start working on this though 🙁

    Meanwhile, one possibility to achieve something like this, would to create a plugin that uses the “wp_table_reloaded_table_css_class” filter to add your custom CSS class there. However, in that filter function you will need to maintain a list of which table ID belongs to which CSS group.

    Best wishes,
    Tobias

    Thread Starter johnflufin

    (@johnflufin)

    Sounds great! Meanwhile, how difficult would it be to edit your current plugin code so that it allows a custom class to be assigned through the short code like so [table id=6 class=type1 /]?

    I see that your plugin consists of several files so if you could kindly point me to the appropriate files I would greatly apprciate it.

    Hi,

    I actually have some code for that ready, as an Extension to WP-Table Reloaded. It does not even modify the plugin files, but uses the filter hooks.

    Can you contact me by mail, so that I can send it to you? My address is in the main plugin file.

    Best wishes,
    Tobias

    It would be very nice to have an ability to assign a class to a table.

    I’ve set up two several sets of CSS rules for different types of tables. Currently it seems like the only option to run several “table classes” is to add each table ID to corresponding CSS selector, which is not very handy.

    TIA

    Hi Daniel,

    yes, as mentioned above, I will try build something like that for a future version.

    Meanwhile, if you are also interested in that custom Extension described above (which allows adding a CSS class to a table with another Shortcode parameter), just contact me by email and I will be happy to share it with you.

    Best wishes,
    Tobias

    Thread Starter johnflufin

    (@johnflufin)

    Hi again Tobias,

    I just noticed that version 1.8 of your plug-in is out and I wanted to see if your CSS class extension still works with the new version. Or has this functionality been rolled into 1.8?

    If not, is 1.7 and the extension compatible with WordPress 3?

    Thread Starter johnflufin

    (@johnflufin)

    Thread Starter johnflufin

    (@johnflufin)

    BTW, why is the book “WordPress Plug-In Development (Beginner’s Guide)” on your Amazon wishlist? Clearly you are NOT a beginner 🙂

    Hi John,

    both WP-Table Reloaded 1.7 and 1.8 work von WP 3 (of course I always recommend using the latest version!).
    The Extension should also still work (it was not integrated into 1.8, but remains separate).

    And regarding that book: Although it names itself “Beginner’s Guide”, I’m pretty sure that even I can learn a lot from it, don’t worry 🙂 After all, its author is a real WP expert.

    Best wishes,
    Tobias

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How do I add a custom CSS class to select tables?’ is closed to new replies.