• Resolved seeker2734

    (@seeker2734)


    I tried to search the documentation and this forum for answers to these questions, and they seem to not be covered yet. So here goes!

    I’m using v1.7.2 of the plugin.

    This post indicates that the plugin should be using the timezone from the WordPress settings, and the changelog indicates that v1.6.2.8 fixed a potential problem with this. However, I noticed that the times in the date related fields in the Record Info group for me seem to be based on the timezone of the server rather than the timezone in the blog settings. Is there something I’m missing or have set up incorrectly? Any way to force it to use the timezone from the WordPress settings?

    Next, I’ve been able to do most styling through the Custom CSS field in the Settings of the plugin. Here’s one I haven’t figured out yet. I’d like to change the font color of the value stored in a checkbox field when it’s displayed in a pdb_list based on whether or not it’s checked, e.g., green font if it’s checked and red font if it’s not. Is there any way to do this type of conditional formatting based on the value in a field? I thought I might be able to do this by putting right in the Values property of the field, especially since the Values property does accept HTML entity codes as values, but that doesn’t seem to work. Thoughts?

    Thanks for your help!

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

    (@xnau)

    The timestamps you are referring to are based on the timezone your database server is set to. You can ask your web host about this, they should be able to set your database server to the preferred timezone.

    Setting the color of the font for a checkbox based on whether it’s checked or not may be possible using the :checked pseudo class.

    If that doesn’t work, you need to use javascript.

    Thread Starter seeker2734

    (@seeker2734)

    Understood re: the timestamps.

    As for the font color, my understanding is that the :checked pseudo class would work for an appropriate input element on a page. However, when the data is simply displayed using the pdb_list shortcode, there’s no input element on the page. There is a checkbox class, but I don’t think it’s seen as an input element. It simply shows the value I’ve assigned to the checked state of the field, which, in this case, is the HTML element for a checkmark.

    I’m looking into how to perhaps implement this with JavaScript/jQuery, but that may be a bit more coding than is worth it (i.e. exactly the right JavaScript/jQuery code, though this looks promising; exactly how to add it to the WordPress site to get the desired results, etc.).

    Thanks for your help!

    Plugin Author xnau webdesign

    (@xnau)

    I see, probably something like an additional class name for the checked state would be good. That’s a good idea for something to implement in the future.

    The normal way to do this would be to use a filter on the checkbox field…for example:

    add_filter( 'pdb-before_display_form_element', 'xnau_add_checkbox_class', 10, 2 );
    function xnau_add_checkbox_class( $return, $field ) {
      if ( $field->name === 'mailing_list' && $field->value === 'Yes' ) {
        $return = '<span class="checkbox checked">' . $field->value . '</span>';
       }
      return $return;
    }
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Timezone and Conditional Font Color’ is closed to new replies.