I have this exact thing working on a current project.
Here’s the code:
<div class="photo-feature" style="background: url(<?php the_field('the-image', $page->ID) ;?>) no-repeat center center; "></div>
Keep in mind a couple of things:
- You may need to use $post->ID or $page->ID if you’re using a custom query.
- Make sure you’re not overriding your background CSS anywhere else (use inspector to double check)
Finally – you should take the single quotes out of your inline CSS.
style: url(path)
not style: url('path')
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Do something with thumbnail image on post publish
- Unable to check if plugin is active
- How to get current post ID in Contact Form 7 wpcf7_before_send_mail hook action
- Using Advanced Custom Fields with WordPress and Lightbox
- How to add meta box to plugin admin page?
- Modify featured image URL at runtime
- How to store ACF custom fields data in a custom table
- Generate Advanced Custom Fields box in custom admin menu page
- Edit Imported advanced Custom Fields from wordpress Dashboard
- ACF for audio url in wordpress audio shortcode
- Meteor Slides as header only for homepage and Use featured image of each page as header for respective pages
- Add custom buttons with custom actions in Edit Post screen in WordPress?
- Custom field in TWIG template – Advanced custom fields plugin
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Admin Dashboard with Custom Tab for Client
- AJAX image upload with a upload progress bar using media_handle_upload
- Loop with array of posts using ‘Advanced Custom Fields’ plugin [closed]
- Converting Attachment to Images?
- Security checking in meta_box save is reluctant?
- Advanced Custom Fields/User Role Editor – how to hide ACF for certain users?
- Last modified field for user profile?
- Advanced Custom Fields
- Get post by ASC from custome field DATE picker
- Getting value from Advanced Custom Fields [closed]
- Pull out Advanced Custom Fields in Related post plugin
- Using a post-signup hook to get user details
- Matching Chapters to a Custom posts [closed]
- Set featured image using javascript in post editor
- How to remove plugin metaboxes from edit.php
- Add padding while generating thumbnail
- WordPress metaboxes – textfield suggestion automatically populated
- Paid Membership Pro with ACF [closed]
- ACF only showing up in Homepage but doesn’t appears in all pages
- Advanced Custom Fields – Disable Users to Edit Custom Fields
- Plugin to hide image in excerpt
- Advanced Custom Fields – Get value in other plugin file [closed]
- Date format – Meta Box plugin
- Meta Box by Rilwis, Load metabox on all page templates EXCEPT the homepage
- Remove Advanced Custom Fields plugin for client?
- Adding class to last list item? Not WP generated
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- Inserting Plugins Into Blank Space of Externally Designed WordPress Theme
- Scrape a webpage for image and add it to post
- Conditional custom redirect
- add_meta_box creating default form field types
- Should meta boxes for specific pages be save in their own plugins?
- How to display a number of posts based on a Advanced Custom Field (ACF)
- Translation to ACF relationship field
- WordPress meta-box and checkbox-list
- How to get the get the select values created by ACF plugin in wordpress
- Adding featured image to posts created by a plugin
- Add_image_size not generating correct size
- Multiple Post Thumbnails Plugin – Need help with code
- How to create repeater field manually, without plugin (ACF Pro)?
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Replace the_content with ACF Flexible Content via function
- Custom Meta box change size
- Revision featured image
- Setting Author on CPT
- Preset custom fields
- ACF checkbox return format based on page
- How to Add call button on a featured image in a wpsite? check the slap king image, there are two buttons on the featured image
- custom fields not displaying on wordpress site
- Display Multiple Photos as Featured Image when mouse moves on to it post
- ACF Fields are not showing up on Homepage
- Why Custom fields description is not working WordPress Version 5.4.2?
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- WordPress create thumbnails on demand
- Change the color of ACF Subtitle output background
- CMB2 Output Select Box Chosen Option
- Will downloading a page builder plugin delete my existing data?
- WordPress CPT Url metabox collection
- Get only selected custom taxonomy
- Get a Taxonomy values in an array
- Automatic set a featured image from the first image’s url (or tag) in the article
- Update (a function) post’s featured image as soon as $image_url changes
- Add_Meta_box to custom page (formidable edit post)
- why my wordpress dont have toolbar like, plugin, themes and other?
- Can’t get or display post thumbnail in wordpress
- Alter add_meta_box
- How to add jquery to my custom post type wp plugin
- How to get rid of error message of custom metabox in dashboard when moving out of edit page?
- Determine if get_the_image has image on Get the image Plugin
- Retrieve post thumbnails
- Define constant for one plugin in mu-plugin
- How can i do custom author list?
- featured image problem with custom post type
- Pulling Advanced Custom Fields from other pages
- Custom time field won’t sort regardless of format
- Meta Box plugin image_advanced not showing up on frontend
- ACF Taxonomy Object term Null [closed]
- when i use wp automatic plugin post shows broken images
- Get URL for featured image for posts? [closed]
- iframe not showing on frontend when using a CMB2 field
- Update acf field in woocommerce orders
- Multiple Post Thumbnails Not Returning URL for Background Image
- add_meta_box showing blank screen in my page
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- Using ACF to allow user to add and edit multiple saved forms