Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to use the_post_thumbnail featured image as the background image to a div container within a page template file.

I'm using LESS CSS and wondered if it was possible to pass in a Wordpress tag to the LESS file or use PHP in anyway?

If not, I guess my only option would be inline style?

share|improve this question
To use a PHP function in a stylesheet you have to create the stylesheet with PHP-- for example, WordPress does this with load-styles.php on the backend--, or configure your server to process .css files as if they were PHP. See:… At any rate, this doesn't look WordPress specific to me. – s_ha_dum Sep 20 '13 at 14:59
Posted it here incase someone was able to come up with a Wordpress specific way of using featured image as background image in CSS. Thanks. – zigojacko Sep 20 '13 at 15:05
WordPress can't escape the basic rules of PHP, HTML/CSS, and HTTP :) – s_ha_dum Sep 20 '13 at 15:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.