Skip to content
Advertisement

Using WordPress Featured Image as CSS Background Image

I’m trying to use the latest post featured image as a background image for a div on my homepage. Can anyone help with the php?

Advertisement

Answer

wp_get_recent_posts() will return a single, most recently published post using the parameters below.

I recommend placing the style in a stylesheet.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement