Home › Forums › Backend Issues (wp-admin) › How to make a background image using a image field › Reply To: How to make a background image using a image field
If You’re new to ACF & PHP – it’s easy.
Step 1:
Make ACF field: image and set “Return Format” option to “Image URL”
Step 2:
Let’s say You give the Label “My background” -> the (autogenerated) Name will be: my_background so:
Now You can use it anywhere in post / page:
<div style="background-image: url(<?php echo get_field('my_background'));">...</div>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.