Menü schliessen
Created: February 12th 2021
Last updated: December 10th 2021
Categories: Advanced Custom Fields,  Php,  Wordpress
Author: Tim Fürer

WordPress Plugin: Advanced Custom Fields short introduction

Tags:  ACF,  guide,  PHP,  Plugins,  wordpress
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

The Advanced Custom Fields plugin for WordPress, is a great tool to reduce hardcoded content in the backend and allows for more dynamic and user-friendly frontend editing. It also expands greatly on WordPress's built-in Custom Fields.

Advanced Custom Fields website

After downloading, your WordPress should have gotten a new Section called "Custom Fields". There, you can create a new field group.

Having done that, you can now add fields to your field group to appear anywhere you assign this group to. This can be Pages or Templates, for example.

You're able to receive a fields values with:

get_field('field_name_here');

There are also repeater-fields, they have their own sub-fields. You can recieve them with:

get_sub_field('sub_field_name_here');

Or you can store the repeater-field in a variable and access it's sub-fields like you would do with an array.

Store this way:

$stored_field = get_field('field_name_here');

And recieve like this:

$stored_field['sub_field_name_here'];

Also, if you want to echo a fields values. Instead of doing this:

echo get_field('field_name_here');

You can just write this much shorter method:

the_field('field_name_here');

This also works the same with sub-fields.