Created
November 27, 2016 07:28
-
-
Save sarvar/4c1283da434eeb900bcf71eebab54cf7 to your computer and use it in GitHub Desktop.
How to customize a divs background dynamically using Advanced Custom Fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div <?php if ( get_field('field_name') ) { echo 'style="background-image: url(' . get_field('field_name') . ')"'; } ?> class="hero container"> | |
| <h2>I Need a Hero</h2> | |
| <p>I'm holding out for a hero 'til the end of the night</p> | |
| </div> | |
| source: http://www.endocreative.com/how-to-empower-clients-to-easily-customize-background-images/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment