Tutorial on using the ACF plugin: creating field groups

ACF (Advanced Custom Fields: Advanced Custom Fields)beWordPressis a powerful plugin that enables users to add custom fields to posts and pages by creating field groups. Each field group containsOne title, multiple fields, location rulesrespond in singingvisualizationThe ability to allow webmasters to customize the content settings according to their needs.

图片[1]-如何在ACF中创建和管理字段组:WordPress自定义字段教程

This tutorial will show you how to create a new field group using the ACF plugin and explain in detail how to add fields, set field types and how to configure position rules to control where fields are displayed.

at the outsetCreating Field GroupsBefore that, install and activate the ACF plugin. Then, hover over the WordPress admin in theACF and select "Field Groups" from the menu.The following welcome screen will be displayed. You will see the following welcome screen:

图片[2]-如何在ACF中创建和管理字段组:WordPress自定义字段教程

Creating a new field group

  1. Adding Field GroupsFirst, go to the WordPress admin backend, hover over the ACF menu and click "Field group "Options. On the Field Group Edit screen, you will see the Welcome screen. Click the "Adding Field Groups" button to start creating a new field group.
  2. Naming field groupsWhen naming a field group, choose a descriptive title, such as"Home"or"maneuver". This title is displayed in the meta box handle on the edit page. Note that the Save Changes button is not active until you add a title to the field group.
  3. Adding FieldsClick on "Adding Fields" button to create a new field. The new field will be added to the bottom of the field list. You can reorder the fields at any time by dragging the serial number in front of the field.
图片[3]-如何在ACF中创建和管理字段组:WordPress自定义字段教程

Field types and settings

Each field group contains one or more fields. By default, the field type is Text. You can click "Field type" drop-down menu to browse all available field types. Below are two ways to select a field:

  • Select Field Type: click "Field type" drop-down menu, from which you can select the desired field type.
  • Browse Fields: click "Browse Fields" button, a modal window with various field types will pop up. You can select a field from the window to view its short description, diagram, and related documentation.
图片[4]-如何在ACF中创建和管理字段组:WordPress自定义字段教程

Each field needs to be filled in "Field labels"and"field name":

  • Field labels: This is the text that users see when editing content, but is not used in the API. It is recommended to use capital letters and spaces to make field labels more friendly to content editors.
  • field name: Field names are automatically generated based on field labels and are mainly used in APIs and templates to extract data. Field names should be in lowercase letters and contain no spaces or special characters.

In addition to this, there are optional settings such as "default value", but these settings will vary depending on the type of field.

field operation

On a field group page, the fields are displayed in a form similar to a WordPress form list. Action buttons can be displayed by hovering over any field. Common actions include:

  • compiler: Opens or closes the field editing screen.
  • make a copy of: Copy fields.
  • removing: Delete the field.

Setting additional options for a field group

The Field Group Settings panel, located below the Field Group Editor, contains several tabbed options for the following settings:

  • Positioning rules: You can set which conditions under which field groups will appear on the edit page. Position rules can be combined to createandrespond in singingorAny combination of statements.
图片[5]-如何在ACF中创建和管理字段组:WordPress自定义字段教程
  • visualization: Adjust how field groups and fields are presented in the WordPress editor.

Positioning rules

Location rules are a very powerful feature in ACF. It allows administrators to define which pages or posts will display these custom fields under certain conditions. For example, you can set a custom field to be displayed only on the "web page" types of articles to display specific fields, or to display certain fields only under a specific category. By configuring position rules, you can precisely control where fields are displayed and the conditions under which they are displayed.

图片[6]-如何在ACF中创建和管理字段组:WordPress自定义字段教程

Contact Us
Can't read the article? Contact us for free answers! Free help for personal, small business sites!
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
This article was written by Banner1
THE END
If you like it, support it.
kudos15 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments