Support

Account

Home Forums ACF PRO Responsive background images Reply To: Responsive background images

  • heh, yes, I had originally thought of making this some type of plugin, but the thought of maintaining it turned me off. It is mostly a plugin but not anything that is fit for public consumption.

    First so you know what you’re looking at, I don’t use jQuery, the script that does the replacement is actually quite small and efficient.

    A little background about the ACF fields. In my ACF field group I have a radio button. The user can select to upload a single image and use WP auto resized images or they can choose to upload a different image for each size. The image widths that are used are 320, 640, 768, 1024 and 1280. The image fields displayed for upload are all conditional fields depending on what is selected. All of the sizes have WP image sizes created for them like.
    add_image_size('image-size-name', $width, 9999);

    In the PHP I get the fields, based on what the user has selected, get the right image urls and generate an tag that is used by picturefill.js

    I put a copy of it on this repo, it is the only thing currently there

    https://github.com/Hube2/blunt-panes

    If you have any questions about the JS I’d be glad to answer them over on the issue section for that repo so we don’t fill up this thread with something that is really not related to ACF.