Display image fields, 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.

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.

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:

<img class="all-fields__image" src="{{ image.value }}" width="{{ image.width }}" height="{{ image.height }}" alt="{{ image.alt }}" decoding="{{ image.decoding }}" loading="{{ image.loading }}" srcset="{{ image.srcset }}" sizes="{{ image.sizes }}">

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:

{{ image.svg_content|raw }}

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:

{{ image.svg_content|replace({'<svg ': "<svg class='my-class' "})|raw }}

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.

Last updated