You could use the plugin “Custom Field Template” to replace standard custom fields with a much easier to use interface, that also allows you to use checkboxes, selects, textareas with tinymce, and file uploads among others.
Then the client would just upload the image through that field and you use
<?php
$bg = wp_get_attachment_image_src(get_post_meta($post->ID, 'custom_field_name', true),'original');
?>
to get the file information. that will return an array, and the image url will be the 0 value. You then do:
<?php
if(isset($bg) && $bg != '')) {
echo '<div style="background:url('.$bg[0];.');">CONTENT</div>';
}
?>
Related Posts:
- automatically set “Featured Image” the same as the og:i that is set in a custom field
- Add url from Custom Field as ‘Featured Image’. Code not working
- For homepage images (for small business website), is it better to use custom fields or post_thumbnail?
- Custom field as featured image caption
- Selectively hiding or allowing thumbnails of featured images on front page
- Use a different catalog image than the featured image
- Crop custom image size vs actual size
- Remove Dimension from wp_get_attachment_image
- Change wp_get_attachment_image attributes (src and srcset) on specific custom field
- Move from old custom field to new post_thumbnails
- How do I make a custom field choose an image?
- Extend WP Customizer to make multiple image selection possible
- Is there a hook / action that is triggered when adding or removing a post thumbnail?
- Add multiple images to a page sidebar
- Display thumbnail from custom field
- Add custom field to image editor
- Display info from custom fields in all images’ HTML
- How can I migrate all of my custom field thumbnails to the built-in post featured image?
- copy attachments to another post type and change attachment url
- limit amount of photos uploaded per cpt post
- Adding a custom field or metabox to the post-thumbnail widget?
- Metabox with multiple fields added by user and upload box
- Add WYSIWYG to Image Description field
- Deleted pages showing up when querying for child pages
- Get Meta from Custom Field of Image URL
- How to display multiple images in custom field
- How to add image attachment to post from a single meta key (Woocommerce)
- Exclude images uploaded via meta boxes from WordPress gallery
- How do I Add images uploaded in the post to a default custom field
- How to add the image URL from an external RSS feed and insert into a custom field?
- Add new image block, set default class name and update it using Javascript
- Better way to save image in custom field
- How do I add an image upload, custom field to a WooCommerce product?
- Select multiple images from custom field
- Redirect to another page using contact form 7? [closed]
- How to mass update custom fields for more than 20k posts
- how to make nsfw post with thumbanil
- Displaying page image in the footer automatically
- Get image url using image id
- Can I use a Custom Field as the Featured Image URL?
- Show image if author meta (profile fields) exists outside loop
- Getting the Featured image URL and inserting it as Custom Field on Post update / publish
- Convert attachment ID into url?
- User customising position of WordPress Featured Image
- Set featured image from custom field URL
- Display a different image for each page with editor
- WP Insert post with post_thumbnail
- Custom field image to Featured Image
- Image upload and path to custom field
- How to get custom image field of specific post id
- Add image URL automatically to custom field?
- wp_get_attachment_image_src() with advanced custom fields returning empty
- Unable to select image with custom field
- Users uploaded image and matching an id or taxonomy
- Adding Facebook’s image and meta description retrieval capabilities to a WordPress post
- use custom field value as featured image
- Can you generate a featured image from two images from custom fields?
- Show image depending on the number in the custom fields
- How to delete attachments associated with custom field type when post property changes? [closed]
- How to add custom fields to images for image source text and URL
- Automatically set the_post_thumbnail to Custom Field Value
- Get first URL from custom field, download and set as featured image on post publish
- Change path to child of page when uploading image via custom field
- Related post thumbnail not showing up
- Analyze uploaded images to get colour values
- Adding thumbnails for non-image attachments
- Post thumbnail size for custom field only
- Upload image to wordpress
- Undefined Variable (Displaying image via custom field)
- Multiple image uploader under editor?
- Get single image from custom fields made with WCK custom fields creator
- Add image custom attribute [closed]
- Custom field for image, not showing image!
- Show/Hide Featured Image or replace it with custom field [closed]
- ORDER BY custom field value
- Converting Attachment to Images?
- Meta_query and numeric comparison [closed]
- How Meta Data is different from Custom Fields of POST/PAGE in WordPress
- Advanced search by two criteria – sort by location and date (ascending or descending)
- Fixing image names for a site being restored
- Displaying a custom field
- Category images are not displaying in WordPress
- How to force WordPress to upscale images?
- Get featured image with custom size outside WordPress
- how to add product subscription field in woocommerce plugin
- How can I change the publish date based on a custom field?
- How to attach images that I “insert from url” into the post?
- theme directory fallback image outputs url and not the image
- Automatically Add Custom Fields Value as Tags
- How to speed up post list slowed by update_meta_cache()?
- Custom Field URL + description
- Save input form on custom field
- Admin – Search Events by a custom field
- I want to add a custom field in the rss title of each post, but don’t want it to be shown on the site
- Custom metaboxes not saving after switching themes
- How to use custom fields to replace top-level parent title with an image using wp_list_pages?
- Including inline Custom Fields info with add_filter in functions.php
- Change Fields of Comments and make them searchable?
- Add CSS class to posts with certain meta key
- Best way for managing images of ads banners