• Resolved oranzie

    (@oranzie)


    Hello,

    I love your plugin and you do an amazing job, i hope you continue ??

    i hope my question is simple to understand, i tried to search the forum and FAQ but did not find an answer,

    I have a table with numbers on a specific column (Column D for example), is it possible to apply that all negative numbers on column D will be in color red ? and all positive numbers in the same column would be green ? (not the background, but the font color of the actual sell), and also is it possible to make it Bold as well ?

    Also – is it possible to apply that to multiple columns ?

    Thank you !

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

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    First, you could use https://tablepress.org/extensions/plus-sign-positive-numbers/ to add a + for all positive numbers.

    Then, this approach might help: https://www.ads-software.com/support/topic/conditional-format-for-negative-positive-values/
    With this, you could search for the - (for the negative numbers) and the + (for the positive numbers) and have those cells highlighted with the CSS code then. However, you might have to search for a “more complicated” scheme, to get unique CSS classes: highlight="+0||+1||+2||+3||+4||+5||+6||+7||+8||+9").

    Regards,
    Tobias

    Thread Starter oranzie

    (@oranzie)

    Thank you

    i have added these, but not working, what am i doing wrong ?

    highlight=”-||+”

    .tablepress-id-1.highlight– {
    background-color: #ff0000 !important;
    }

    .tablepress-id-1.highlight-+ {
    background-color: #ff0000 !important;
    }

    (theres a double minus on the “highlight– {” part, but the forum is removing it.)

    • This reply was modified 4 years, 11 months ago by oranzie.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    that simple way will not work, because the + highlighting will also get the CSS class .tablepress-id-1.highlight-- (with two -), due to the WordPress PHP function sanitize_title_with_dashes() that is used).

    In the PHP file tablepress-cell-highlighting.php, you could maybe change line 215 from

    $cell_class .= ' highlight-' . strtolower( sanitize_title_with_dashes( $highlight_term ) );
    

    to

    if ( '+' === $highlight_term ) {
      $highlight_term = 'plus';
    }
    $cell_class .= ' highlight-' . strtolower( sanitize_title_with_dashes( $highlight_term ) );

    After that, the CSS for the + should be

    .tablepress-id-1 .highlight-plus {
      background-color: #ff0000 !important;
    }

    (Also, please add a space between .tablepress-id-1 and .highlight-- in your CSS!)

    Regards,
    Tobias

    Thread Starter oranzie

    (@oranzie)

    Thank you for the quick comment,

    that could work for the Plus, what about the Minus?

    (There is space, its just being removed when pasted to this forum)

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    the - case is fine, you can continue to use it without modifications. The CSS selector .highlight-- should work here.

    Regards,
    Tobias

    Thread Starter oranzie

    (@oranzie)

    Sadly, it does not.

    I have edited the PHP

    and only used

    .tablepress-id-1 .highlight-- {
    background-color: #ff0000 !important;
    }

    and set the shortcode to

    [table id=1 highlight="-" row_order=sort row_order_sort_column=A row_order_sort_direction=DESC /]

    however – still not working

    • This reply was modified 4 years, 11 months ago by oranzie.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Thread Starter oranzie

    (@oranzie)

    Sure, the page is this one:

    • This reply was modified 4 years, 11 months ago by oranzie.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks! From looking at the code of the page (“View source” in the browser), it actually looks like that the CSS class for the minus only needs one -. So, please try again with

    .tablepress-id-1 .highlight- {
      background-color: #ff0000 !important;
    }

    Regards,
    Tobias

    Thread Starter oranzie

    (@oranzie)

    Sadly, still not resolved

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    ah, my bad. Your table is not ID 1, so you’ll have to use

    .tablepress-id-AUDJPY .highlight- {
      background-color: #ff0000 !important;
    }

    Also, I recommend to put this in the “Custom CSS” of the TablePress “Plugin Options” and not in the custom CSS of the theme.

    Regards,
    Tobias

    Thread Starter oranzie

    (@oranzie)

    Thank you so much !

    Is it possible to somehow add a global CSS ? meaning not per table, but for all tables ?

    As for Plus sign, i have added the plugin, and my shortcode is:

    [table id=AUDJPY
    plus_sign_positive_numbers="E-F"
    highlight="-"
    row_order=sort row_order_sort_column=A row_order_sort_direction=DESC /]
    

    however, no plus signs added to column E and F , also if i put ‘true’ it does not show any plus signs.

    • This reply was modified 4 years, 11 months ago by oranzie.
    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    did you download, install, and activate the TablePress Extension for this?

    To make the CSS work globally, just replace with .tablepress-id-AUDJPY with .tablepress.

    Regards,
    Tobias

    Thread Starter oranzie

    (@oranzie)

    Yes, sure did install and activate it

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    If possible, I’d like to take a direct look at this on your site. Could you therefore please get in touch via email (the address is in the main plugin file “tablepress.php”)? That way, I can investigate this directly. Thanks!

    Regards,
    Tobias

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Color a cell by its content’ is closed to new replies.