Durée de la vidéo :21:
Welcome to the Custom Fields WordPress tutorial. In this tutorial I have explained how we can add custom fields to wordpress posts or pages using Advanced Custom Fields WordPress Plugin.
Using the advanced custom fields plugin you can add any number of fields like you know below this content or below the title that means above the content like you know you can have any number of fields and different types of fields like text field, text area etc., using this plugin.
Not only on posts, you know, there are different options, like you know, on pages or only on some category posts etc., you can use this plugin and you can easily add the new fields here and I will show you how to do that one.
For doing this one, first you have to install the plugin so go to plugins and click on add new.
In the search box search with the words advanced custom fields.
This is the plugin that we are going to use.
Click on install now.
« Are you sure you want to install this plugin? », yes, click on « Ok ».
Now the plugin is installed and click activate plugin to activate the plugin.
Ok, now the plugin is activated and you can see the plugin under installed plugins section and once the plugin is activated, you will a new menu item called « Custom Fields » on the left side menu.
so,click on custom fields.
So once u click on custom fields like you know this is the page that will be shown up and here you will see something called field groups.
So the first thing you have to do is you have to add a field group.
So what is a field group?
A field group is nothing but a group of fields.that means what are the fields u want to add like txt field,txt area radio buttons etc.you will group them as one field group.
so this is called a field group.
so first thing u have to do is u have to do add a new field group.
so click on add new here.
so once u click on add new field group so the first thing is to give a a new name here for this purpose what I am doing is I am giving it as test field group.
secong one is we have to add the fields we want to have under this field group.
So click on add fieild.
So the first one is I would like to add a text field so for phone number.
So what I am doing is I adding you know phone number. This field name will be automatically shown up. Field type we have to select here.
Here we have different options like text field, text area, Number, Email, Password etc.
So for this article purpose what I am doing is I am doing is I am adding these two fields.
A text field for phone number and a text area for address.
So select text here.
You can add any field instructions here. So if you can enter « Please enter your phone number here. »
So if you want to make it as a required field you can select it as « Yes » otherwise « No ».
When it is required field yes means while you are making a post if you don’t enter you know the phone number then it won’t allow you to publish this one.
So let’s select yes here and default value you know you can put a default value like « 1234567890 ». So this is the default value that will appear.
So there are some other options which you don’t need to use so the first thing I have done is I have added a text field.
I would like to add another field which is a text area for address purpose. So click add field one more time and here like you know the field label is address and filed name will automatically pop up under the field type select text area here. So enter the field instructions enter « please enter your address here ».
So for required no it is not required. We are leaving it as default value here.
Default value, you know you can enter any default value here.
Number of rows I am limiting it to 4.
That means only four rows will appear and you know, now so we have added a text field and a text area field.
Next one is the location where exactly you would like to have this field group that means the new fields that we have added which are text field for phone number and text area for address where exactly you want to display them.
Do you want to display them on a post or a page or anywhere else you have these options.
If you want to display it on a post type, then you have to select this like you know you have different options here post type etc. You have to select post type equal to post.
If you select it page here the options will appear on a page. We would like to do it on a post so select it as post.
So for this article purpose I am selecting Post Type is equal to Post here
Click on publish.
Ok. So now the field group is saved and the field labels are phone number and address and this is the field name here. The field names are phone_no and address so these two things we have to remember.
Now let’s try to make a post here.
So what I am doing is I am trying enter a post here.
Once you make the post now you have to add some code to your template to display these newly added information on your posts.
"Custom Fields WordPress | Advanced Custom Fields WordPress vous a satisfait ?"
Donner votre avis