• Resolved Cameron

    (@cameron-macintosh)


    I need to restyle a column in a specific table. Specifically, the Phone number column in a table of contacts. (not all tables in my site are lists of contact info, or have a phone number column)

    I see that TablePress provides ID=”tablepress-##” and class=”tablepress-id-##” for table selectors (and column-## for columns). However, I would prefer to not tie css stylings to database IDs and arbitrary columns.

    Is there a way to give each table (and/or column within a table) a custom css id/class so that stylings can be more agnostic? aka being able to style .my-custom-tablepress-class > .phone-number-column rather than .tablepress-5 > .column-2. I see this option as a better practice for targeting tables and more robust should the table’s ID change or the columns get reordered.

    Thank you in advance.

    https://www.ads-software.com/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question.

    I have good news and bad news here ??
    Good news: Adding such a class to the table is easy, just paste the desired my-custom-tablepress-class into the “Extra CSS classes” textfield on the “Edit” screen of the table.
    Bad news: For columns, this is not possible. Those will always have a reference to the column number, so you will need to stick with that. Sorry.

    Regards,
    Tobias

    Thread Starter Cameron

    (@cameron-macintosh)

    Thanks! I overlooked the “Extra CSS Classes” field.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    sure, no problem, you are very welcome!
    I hope this helps!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Is there a way to give a specific table a custom CSS class?’ is closed to new replies.