1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 Accessing custom field from EXTRA.css

Discussion in 'XenForo Questions and Support' started by NewGamePlus, Aug 9, 2015.

  1. NewGamePlus

    NewGamePlus Member

    I've been trying to set up a system where the site font is replaced from a custom field, but $visitor seems to be null inside EXTRA.css. What am I doing wrong?

    I've tested using the dumper: {xen:helper dump, $visitor} produces "<pre>NULL
    </pre>".

    The idea is to apply the font globally using this css:

    * {
    font-family: '{$visitor.customFields.font}', sans-serif !important;
    }

    I know it's dirty but we have like 8 themes and the font is defined everywhere multiple times, so I went with this hack.

    site: new-game-plus.com
     
  2. Mike

    Mike XenForo Developer Staff Member

    You simply can't do that. Visitor information is not available in CSS. You would need to define that CSS inline with the page.
     
    NewGamePlus likes this.
  3. NewGamePlus

    NewGamePlus Member

    Hmm, I thought it would be something like that.

    Instead of having it user-selectable I just set it in the theme and made selectable themes. After erasing font properties on lots of places, it seems to be correctly inheriting them from Body.

    Thanks! Everything is working fine now.
     

Share This Page