On this page I will explain how to create fields. It does not matter if it is for admin pages or for meta boxes, it works the same way.

Create fields:

To create fields you must first create a metabox or admin page:

1) Create Metabox

 

2) Add fields

Next we will create a colorpicker field:

Now let’s add a field of type checkbox.

Result:

Get saved values:

To get the values of the fields we have to do the following:

Get field values for Meta Boxes:

Use the following code to get the values. Use only inside your template files. e.g. ( index.php, single.php, archive.php):

Or inside any hook that runs after ‘init’. Never before, never inside the init.

 

Get field values for Admin Pages:

Use the following code to get the values. Use only inside your template files. e.g. ( index.php, single.php, archive.php):

Or inside any hook that runs after ‘init’. Never before, never inside the init.

 

You also have the following function available which does exactly the same thing:

Shortcode:

Documentation Menu