• Resolved dkurth

    (@dkurth)


    The code nicely greys out the read only fields on the backend (admin) section. But for some reason, it does not do the same for a front-end display. Is there something I am missing. It is setup exactly the same.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    CSS that’s only added on the admin side? Best guess I have at the moment

    Thread Starter dkurth

    (@dkurth)

    Well I will look for a readonly css value, at the moment, using google tools, there does not seem to be a unique “hook” for readonly, which makes me confused. But your bring up a good point. I will compare the backend css values with the front end css values.

    Thread Starter dkurth

    (@dkurth)

    Found it. Have no idea how to fix it at the moment, but the WP load-styles.php file is not being loaded on the front end. Perhaps this is due to the fact that I am using a custom post type on the backend and hooking CMB2 into the custom post type.

    May try and see if changing it to a custom post type, instead of the global post type, to see if it would fix the problem. let you know….

    Thread Starter dkurth

    (@dkurth)

    So it appears to be that if you set the CMB2 metabox to “not displaying” on the front end, the readonly grey out works. But if you have the fields displayable on the front end it does not.

    The CSS values:
    input.readonly, input[readonly], textarea.readonly, textarea[readonly] {
    background-color: #c04d4d;
    }

    Is only included on the backend (admin) of the site. I am wondering what the difference is in the code for :

    ‘on_front’ => false,
    vs
    ‘on_front’ => true,

    Thus far, that is the only difference between the 2. Otherwise, the code is working very nicely. The irony is, I need the readonly display more importantly on the front side, that the admin side.

    Any thoughts on this?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    My main thoughts would be to just write up your own quick CSS to help with the frontend display, truth be told.

    I just checked the CMB2 codebase for both “c04d4d” and “readonly” in the sass/css files and neither are coming up. I could see false negative results if the sass files use say the rgb() representation of that hex color, but the readonly selector not being present at all has me thinking this is a selector coming from WP core and their admin styles.

    It’d be more time efficient, at least in my mind, to add some styles to the customizer “additional css” spot or a quick wp_head() callback, to get things rolling faster. However, I understand different experience levels and skillsets as well.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘READ ONLY FIELDS ON FRONT END’ is closed to new replies.