Image
Display image meta fields (like ACF Image field) and Post featured images.
In the Basic version, if you add an Image field to your View you'll have the option to the select Image Size. In the Pro version you can enable the image Lightbox and slider option.
1. Crop images
Default crop sizes are available for selection when assigning an image field in your View.
Note: Professional themes often come with additional crop sizes, these will also be available in the list for selection.
How to use it
Visit the Advanced Views Framework tab in WordPress backend.
Click on the Edit link or Title of your View to edit.
Click the Add Field button.
Select Post (WordPress) from the Group dropdown.
Select Featured Image field from the list or Select Featured Image with link. Or any other group and field that is an image field type.
An extra Field appears called Image Size, select the preferred image size from the list.
Click on the Update button to save and publish your View.
2. SVG format support
By default, WordPress doesn't allow uploading .svg
files into the Media Library. However, this can be configured using some dedicated plugin.
AVF supports SVG out-of-the-box. As you may have seen, an ordinary image has the following markup by default:
This doesn't work for SVG, so AVF provides a separate field property for SVG cases: svg_content
. When you expect an SVG to appear, you should use instead:
This field contains the content of the SVG, so it will be placed on the page as an inline SVG image.
Why inline? Because only inline SVGs support color changes, allowing you to style it with CSS and even change the color on hover.
If you need to assign a class to the SVG element, you can use the following trick:
3. Advanced usage
3.1) Image as a link
If you need to wrap an image in a link, add both the Link and Image fields to the same View and save it. Then, copy the default auto-generated template and modify it so that the image tag is inside the link tag, like this:
3.2) Background image
You can turn an image into the background of any element by defining the background-image property inline, like this:
After that, don't forget to add the following CSS rules to the CSS field of your View:
Another approach is to use an <img>
tag within the target element and position it absolutely. This method allows for more control over the image, such as adding effects or transitions.
3.3) Scale-on-click effect
Instead of using a lightbox, you can apply a "scale" effect to enlarge images on click, keeping the layout intact. This method provides an easy way to view larger images directly within blog posts or content areas.
Image tag in the template:
JS code:
CSS code:
4. Lightbox (Pro)
Follow the guide above to assign an image field to your View.
From the Lightbox dropdown, select Simple for a lightbox with no settings, or select LightGallery for a richer looking lightbox, with slider and settings to control the functionality.
Known issue with Smush - Optimize Images is that thumbnails don't load as the image src is modified. Exclude images by adding 'acf-views' to the exclude keywords.
Publish or update your View.
Customize the Lightbox in the JS Code field under the CSS & JS tab.
The default instance settings:
Last updated