How to overwrite add_image_size in child theme
-
Is it possible to overwrite post thumbnail sizes set by
add_image_size
from a child theme (or more likely detect sizes already set and not overwrite them if found in the parent theme?)Functions need special immediate attention when creating parent themes since sites crash with duplicate function declarations, whereas
add_image_size
easily slips under the radar with the parent functions.php file being called after the child thereby overwriting sizes which I’d naturally like to take preference.Obviously the
add_image_size
declarations could be wrapped in a function in both the child and parent themes and the parent function only fired if the child function is not found, but unless this is done on an individual-size-per-function basis there’s no way of knowing which sizes have been written in which.I’m using the
if(!foobar) function foobar
type statements in the parent theme at the moment: can an equivalent be done with add_image_size?
- The topic ‘How to overwrite add_image_size in child theme’ is closed to new replies.