• Resolved johnbrid

    (@johnbrid)


    Hi
    I am using the customizr theme with my own child theme.I have used table press to produce a really nice table for our holiday cottage availability.
    As weeks are booked i want to change the color of a single cell to red to denote it is booked.(about 2 changes a week) Before i tried wordpress i uses to use html and would use something like
    <td style=”background-color:##FF0033;”>Booked</td>. I have also got to grips with the plugin options section and used css code to color whole columns but it seems a bit complicated to color a single cell every time we get a booking.

    I have tried all sorts in the advanced editor but nothing seems to work.
    I exported the table as an html and edited it in dreamweaver to the code above and the cell background was red. I imported back it into my wordpress site and it wasn’t.
    I can easily produce colored text in a single cell but is there an easy (any) way to color the background of a single cell?.

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    Have you seen the suggestion for “Custom CSS” from https://tablepress.org/faq/highlight-cells-or-content/ ? That should be the best approach here. Adding a cell background color from within the cell content is not directly possible, due to how CSS works (it can only affect child elements, but not parent elements).

    Another idea would be to use automatic highlighting of the cells, whenever the cell content is “Booked”. For that, please see https://www.ads-software.com/support/topic/tablepress-highlight-a-cell-based-on-value?replies=9 for a suggestion.

    Regards,
    Tobias

    Thread Starter johnbrid

    (@johnbrid)

    Thanks for the quick response.
    I had seen the first suggestion and wanted to avoid it due to the regular updating of the site and having to put a new line of code in every time we got a booking as well as putting in the word Booked. I know i would get muddled with which row and column I was dealing with.
    However i do like the look of the second suggestion very much and had not found that. I have always thought computers were supposed to make life easier and this certainly will if I can get it to work. I will have a go over the next few days and let you know how I get on as it may help others.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    yes, in that case, the second suggestion with the TablePress Extension should be a good way. It also has some (short) usage instructions in the PHP file that the ZIP archive contains.
    If you have any questions about it, just let me know.

    Best wishes,
    Tobias

    Thread Starter johnbrid

    (@johnbrid)

    I have installed the plug in and read the bit at the top of the php file but I am struggling.
    I put the following into the tablepress plugin options but it did not work

    /*colours cells red with Bkd in them in table id=1*/
    [table id=1 highlight=”Bkd” /]
    .tablepress-id-1 .highlight-Bkd {
    *background-color: #E00000 !important;
    }

    I suspect I should be putting [table id=1 highlight=”Bkd” /] somewhere else but not sure where?
    Can you help?
    Thanks
    John

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi John,

    [table id=1 highlight="Bkd" /]

    would be the modified Shortcode that would replace the existing one, on the page where you are showing the table.

    For the “Custom CSS”, please change that to

    /*colours cells red with Bkd in them in table id=1*/
    .tablepress-id-1 .highlight-bkd {
      background-color: #E00000 !important;
    }

    Regards,
    Tobias

    Thread Starter johnbrid

    (@johnbrid)

    Thanks Tobias.

    That makes a lot more sense. Tried and it works brilliantly. I had been reading on various forums that no table plug ins in wordpress allows you to color single cells. Tablepress does. Well done and thankyou again.
    John

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Altering the background color of a single cell’ is closed to new replies.