how to : function.php of a theme


can you explain when function.php of a theme is called ?

in fact, in this file, I change thumb size on the fly as the device is a mobile or not (of course I can use css to resize).

by default and for desktop device, thumb size is 220
if mobile device, thumb size become 350.

but sometime, thumb size is not changed (it remains 350 on desktop device)

I whish to understand why.


  • acrylian Administrator
    functions.php is basically called like a plugin but basically after all actual plugins (of all types) are loaded. Reason is naturally so themes can use functionality provided by plugins.

    Note that if you are using mobile detect it might not always be accurate as not all devides send their info correctly (and you can modify it via browser as well). Better is maybe to use new responsive images stuff available via html5 actually. Maybe take a look at the picturefill plugin (the next major version actually will have something for that built in btw).
  • it seems it was a cache issue.

    of course, the best way is to use html, css,... to resize picture, or to use different sized pictures for different devices.
Sign In or Register to comment.