Wordpress lessons, Sitebuilding

Configuring advanced input elements in WordPress API

wordpress api

When the user completed the introductory course and gained the relevant skills in working with API and other options of the theme, then it’s time to study the remaining 3 input functions and methods of their implementation in the structure of the theme.
wordpress api

Types of items

Checkbox – checkboxes

In previous articles we have described all the nuances of creating the checkboxes, you can now return to this subject and make additional amendments. This will help special option sandbox_theme_initialize_input_examples. Users simply add the tag with the id attribute, which serves as the identifier to associate a particular tag with a checkbox.
To save the amendments you need to gradually perform the following steps:

Set the flag and store the values;
When the page is updated, the stored values should remain;
Take the flag and maintain the data;
Again updated the page, all values of the flag should remain in place.

In practice, all the steps are easy. The versatility of the WordPress function checked API opens up new possibilities to check, read and set values. Despite the fact that this function can take 3 arguments, only the first is required:

The first value is considered to be one of the compared;
The second value to be compared, if the first is not considered to be true;
To display or not display in the browser window the checked value.

Radio Buttons – radio buttons

In most cases, the radio buttons are considered to be those elements that were most often combined in a special group. They allow users to choose the most appropriate one of the mutually exclusive options.
Quite often in the process of creating the radio buttons the developers, who are accustomed to working with WordPress, have had problems. This is due to the fact that in the process of working with the radio buttons they may behave differently than other elements with the specified name and id attributes. We should also notice that the id attribute is completely unique and must not match other element values.

In addition, each label of the input elements of the definition of uses the id attribute. Due to this, you can bind a label to a radio button and the user can always click the label and change the status of the selected item. The name attribute is always the same for each radio button, but the cart value will significantly different. All these nuances make the radio buttons is unique.

Select Box – a drop-down list

This element provides users with a very extensive drop-down list of defined choices. Work plan this element is quite simple:

Select the item (for example: just three values);
Values are: “Always”, “Sometimes” and “Never”;
Select the default option that is displayed automatically when the page loads.

In the process of creating the drop-down list the basic attributes are considered to be name and id. Each option is assigned a unique value attribute and special text labels. Also, use the option selected, which is provided by WordPress API.

In conclusion, we summarize that in this article, we have passed a quick guide to setting up a checkbox, radio button and drop-down list. These elements allow us to create functional and secure pages settings, which, as well as all analogues require the right approach and subtle software settings.