WordPress plugin intelligence profile

Advanced Custom Fields: Snippets

Adds useful functions for rendering image fields, link fields, repeater fields and flexible content for the Advanced Custom Fields plugin.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 5.2
Current version1.0.0
WordPress coverageTested up to WordPress 5.2
Minimum stackWP 4.8 · PHP 5.4
Directory statusactive
Last directory update8 Jun 20197y ago
Active installationsNewAdoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Advanced Custom Fields: Snippets version 1.0.0 as active, updated 7y ago and tested up to WordPress 5.2.

Overview

About this plugin

Adds useful functions for rendering image fields, link fields, repeater fields and flexible content for the Advanced Custom Fields plugin. For detailed info look on Bitbucket.

Main advantages

  • write less code (do not repet same blocks of the code when writing down ACF custom fields)
  • built-in filters
  • works also for Gutenberg ACF Blocks
  • no init hooks etc (no impact on performance)

Usage

Link

Returns the snippet of a specific link field.

>

Displays the snippet of a specific link field.

>

Parameters

$selector (string) (Required) ACF field name or ACF field key. Based on ACF get_field function.

$postId (integer|bool) (Optional) The post ID where the value is saved. Use true for getting sub field. Default value: false (current post).

$args (array) (Optional) Array of link output arguments. Default value: null.

‘class’ (string) class attribute of the anchor.

‘id’ (string) id attribute of the anchor.

‘title’ (string) title attribute text of the anchor.

Image

Returns the snippet of a specific image field.

>

Displays the snippet of a specific image field.

>

Parameters

$selector (string) (Required) ACF field name or ACF field key. Based on ACF get_field function.

$postId (integer|bool) (Optional) The post ID where the value is saved. Use true for getting sub field. Default value: false (current post).

$args (array) (Optional) Array of image output arguments. Default value: null.

‘size’ (string) Image size to use. Accepts any valid image size. Default value is full.

‘alt’ (string) alt attribute of the image.

‘id’ (string) id attribute of the image.

‘class’ (string) class attribute of the image.

‘title’ (string) title attribute of the image.

‘srcset’ (bool) Use true for retrieving image’s srcset attribute. Default value: false.

‘loading’ (string) loading attribute of the image. Default value: lazy.

‘link’ (bool|array) Array of attributes for anchor wrapped around the image. Default value: false.

‘href’ (string) href attribute of the link.

‘target’ (string) target attribute of the link.

‘class’ (string) class attribute of the link.

‘id’ (string) id attribute of the link.

‘title’ (string) title attribute of the link.

Repeater

Displays the snippet of a specific repeater field.

>

Parameters

$selector (string) (Required) ACF field name or ACF field key. Based on ACF get_field function.

$postId (integer|bool) (Optional) The post ID where the value is saved. Default value: false (current post).

$args (array) (Optional) Array of repeater output arguments. Default value: null.

‘template’ (string|array) Template for items inside the loop. Arguments of get_template_part function. In the template use standard get_sub_field function.

‘wrap_before’ (string) Text (HTML) before repeater items while have rows.

‘wrap_after’ (string) Text (HTML) after repeater items while have rows

’empty_html’ (string) Text (HTML) in case there are no rows in repeater.

Flexible content

Displays the snippet of a specific flexible field.

>

Parameters

$selector (string) (Required) ACF field name or ACF field key. Based on ACF get_field function.

$postId (integer|bool) (Optional) The post ID where the value is saved. Default value: false (current post).

$args (array) (Optional) Array of flexible content output arguments. Default value: null.

‘templates’ (array) Array of templates for flexible content layouts. In the templates use standard get_sub_field function.

key (string) – layout name

value (string|array) arguments for get_template_part function.

Requires Advanced Custom Fields (Pro)

Examples

Link field

>

Image field

>

Repeater field

php acf_snippet_the_repeater( 'team_members', false, [ 'template' => [ 'templates/loops/loop', 'team-member' ], 'wrap_before' => '<ul class="about__team">', 'wrap_after' => '</ul>', 'empty_html' => '<p>'. ', 'web' ). >

Flexible content field

php acf_snippet_the_flexible_content( 'fp_content', false, [ 'templates' => [ 'slider' => [ 'templates/homepage/snippet', 'slider' ], 'counters' => [ 'templates/homepage/snippet', 'counters' ], 'text_block' => [ 'templates/homepage/snippet', 'text_block' ] ] ] );

>

`

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • advanced custom fields
  • acf
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 5.2

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 5.2.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to5.2
Minimum requirementsWordPress 4.8 · PHP 5.4
Update activity8 Jun 20197y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.