Translations of this page:

Custom Fields

Custom Fields is the most important part of Magic Fields. Magic Fields has 15 different types of Custom Fields which we will talk about later. In this section we will talk about the general options of the Custom Fields.

We can add Custom Fields to any Post Type registered in the system. To add Custom Fields to a Post Type go to the menu Magic Fields → Magic Fields.

This link will take us to the Magic Fields dashboard where we will see the Post Types and Custom Taxonomies.

To add Custom Fields to a Post Type click on the “Edit Fields/Groups” in the Post Type.

This will take us to the Custom Fields dashboard of the Post Type. There we can see the Custom Fields and the groups that we have for that Post Type. For each Custom Field we have a brief description of the field, label, name and type of the Custom Field as well as the “Edit” and “Delete” options.



Create a Custom Field

Click on the ”+ Create a Field” button in the Custom Fields dashboard in the upper part of the form. This will take us to the create a Custom Field form.

The form has two sections:

  • General Information.
  • Custom Field Options.



General Information

These options are the same for all Custom Fields:

  • Label : This label will be showed in the post area.
  • Name : The name of the field, must be unique within the Post Type, with this name we'll recover the value of the field in the front-end (our Wordpress theme).
  • Help text : Help text for the Custom Fields that would be showed in the post area.
  • Type of Custom Fiels : What type of Custom Field for this field. See Types of custom fields section.
  • Required : Check this option is you want the field to be mandatory.
  • Can be duplicated : If you want the Custom Field to be able to be duplicated in the post area check this option. If you wish to know more about about this option read the duplicate fields section.

When we send the form Magic Fields will verify that the required fields aren't empty and that the “Name” is unique, in case that “Name” is already in the system it will show us a message.

Another characteristic of this section in the form is to leave the label and the “Name” empty and this will automatically give us a suggestion for the field. If we're creating a Custom Field inside a group it will add a prefix with the name of the group in the “Name” field. You can see how it works in this video.



Custom Field Option

On the right side of the form there is a section that will show us a preview of the Custom Field and its additional options. Depending if the Custom Field has it or not. In this video we can see some options of the Custom Fields.



Edit a Custom Field

To change the Custom Fields configuration click on “Edit”.

This will take us to the same form where we created the Custom Field where we can change any option of the field, even the Custom Field type.

When changing the Custom Field type we must be careful that the values that were already stored in the Post Type elements don't cause a conflict.



Deleting a Custom Field

When deleting a Custom Field the reference that it may have to the Magic Fields will be deleted. Only the reference to the saved field will be stored in Wordpress (postmeta).



Using a Custom Field

When creating or editing an element of the Post Type that has Post Types associated to it, the fields will be visible depending on the Custom Field type.

We can see that the options chosen for the field (Label, required, helptext and duplicated).

To show the Custom Field information in our Wordpress theme you must use the template functions, each of these functions will help us show in an easy and fast way the information corresponding to each field.



Sort Custom Fields

Magic Fields allows selecting the order of the Custom Fields that will be showed in the post area. In the Custom fields dashboard of the Post Type where there are two arrows next to the “Label” field.

All you need to do is drag these arrows and place them in the required position.

In the next video we can see how sorting Custom Fields works.

custom_fields_v20.txt · Last modified: 2011/08/01 18:53 by bcorona