Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #331156

    Hi!

    I have a pricing table which I am using as a working hours table. Basically I want to set all its background in white except the cells where you see “ABIERTO”. Those ones would be in another colour, dark purple.

    I’ve read a lot of threads but non of them (I didn’t find anyone) was fitting my needs.

    Can you help me, please?

    Thanks!

    • This topic was modified 10 years, 1 month ago by blancocapell.
    #332833

    Hi,

    Try adding this at the very end of your theme / child theme functions.php file:

    function td_abierto_script(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
        	$('.avia-table td').each(function() {
                  var $this = $(this);
                  if($this.text() == "ABIERTO"){
                        $this.addClass('td_abierto');
                  }
            });
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'td_abierto_script');

    And this to Quick CSS:

    table td, table th {
        background: white;
    }
    .td_abierto{
        background: purple;
    }

    Regards,
    Josue

    • This reply was modified 10 years, 1 month ago by Josue.
    #333361

    Hi Josué.

    That doesn’t work because of two reasons:
    1) It applies to all of the tables, so for example in the tab “Talleres” you can see all the tables in white, and it was cool already like at the beginning.
    2) We should also change the text colour to black to ALL the cells. Note that now, in the purple ones, the text is not black, it’s a gray very dark.

    So, basically, I want the change only for that table I told you. I created a custom CSS class for that table, if it helps. It’s called “naikare-horario”.
    And also I would want to let you know that at the end I’m not planning to have “ABIERTO” in the cells. This means that the function (or whatever you provide me) shouldn’t depend on the text.

    Thanks again, and sorry for all the mess :P

    #333397

    Hey!

    Thank’s for your feedback.

    Out of the box the table object does not support your request. If you need that, you have to modify

    enfold\config-templatebuilder\avia-shortcodes\table.php

    to allow to add specific classes to single cells. This will be the only way to be independent from cell content.

    But this is beyond the scope of support.

    Best regards,
    Günter

    #334060

    Oh…

    Well, OK, I understand it.

    Thanks anyway.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Change specific cells background colour in a specific table’ is closed to new replies.