Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Maria Khair
Maria Khair
418 Points

How do I make a background image dynamic?

Hi, I am currently developing a theme where I want to make my background image (which i declared for my css stylesheet) dynamic in a way that if a user uses it, he/she can put their own backrgound image.

I tried making a custom field/custom post type but I'm afraid I did it wrong.

Can anyone tell me how they would put up a background image section?

1 Answer

Hi Maria,

WordPress has a native "custom-header" that can be set up in your functions.php and let the user then replace with their own image in the customizer.

Codex Custom Headers

I used it when building this mess around site

If you would like the code I used I can send it over ?

Craig

Maria Khair
Maria Khair
418 Points

Hi Craig, thanks for answering.

It would be great if you could send the code over!

Thank you so much

Hi Maria,

Sorry for the delay in getting back to you.

Are you wanting to set the image being used as a background of use as the src attribute in am img tag?

The code I have is set up to work with it as an background at the moment but I can help you set up as img tag if needed :)

Craig