Imagine someone creating an open source JavaScript management interface for the WordPress site, named after the Greek halfling. You may be thinking, wow, great, I wonder if I can make it run on my website. However, you will begin to think about all the custom metaboxs and other types of custom forms that plug-ins add to posts, terms, and user editing screens. No standard declares the fields that metabox’s standard or plug-in should use. Things that create \
Many people, including me, have talked extensively about the future of WordPress based on API. In the first article of torque of rest API, Andrew nacin, the chief developer of WordPress, told the audience at Wordcamp milwauke in 2014. The representative of WordPress was the rest API, which was called metadata project at that time. Now, part of the rest API is at the core. The metadata project, currently known as the fields API project, has made great progress, but there are few contributors and is not ready for use in the core. The
If there is a fields API in the WordPress core, and the plug-in uses it to declare fields, you can solve the problem at the beginning of this article. Developers who create javascript based interfaces can determine the field name, type, and storage location of each plug-in, and generate important metaboxs for each plug-in programmatically. The task of word press core is to provide the infrastructure to make new and enhanced interfaces possible. The rest API infrastructure is a huge step in the right direction, but the fields API is equally important. The absence of the fields API will not only suppress Calypso, but also the alternative user interface of WordPress or all types of applications, making it a regular \
I recently talked about the progress and possibilities of Scott Kingsley Clark and fields APIs. Scott is the chief developer of the fields API project, the chief web engineer of 10up, and the chief developer of the pods framework. I want to show what he told me and how to create a glossary editor using the fields API. Progress of fields API in mid January, Scott released a thorough update to the fields API project. Since then, he and other participants have made more efforts on the project. Not yet complete, may need more help, but lays the foundation for creating standards for field declarations. This includes all posts, users, meta fields, or options required by the plug-in or topic. The
The fields API project is not about field declarations, but allows the automatic creation of administrative and front-end forms for editing fields. Scott said through the fields API that developers do not have to \
As a proof of concept for the fields API project, the plug-in edits the user meta fields generated by the fields API
Includes. This is a good demonstration, but it is a hint of what the kernel’s complete fields API does. \
This is a huge deal. WordPress is an application framework that requires a rest API or later. We need a way to connect all the key data types with the large number of plug-ins added to them in a standard way to build new applications. Scott used the fields API to say: \
How it works last week I wrote about the new term metadata function of WordPress 4.4. I didn’t show you how to create an administrator interface for it. Instead, you can create your own forms, or return this week to see how to create forms using the fields API. To demonstrate how easy the fields API is, we created a simple plug-in to register two taxonomies. One is called \
Most of the code in the \
Male add\u action (‘fields\u Register’,’josh\u city\u term\u fields’); Create a section using the add\u section() method of the wp\u fields\u API class. To do this:\/**
*@param wp\u fields\u API $wp\u fields
*\/The
Function josh\u city\u term\u fields ($wp\u fields){
\/\/What is the WP object type?
$object_type= \
\/\/What classification?
$object_name= \
\/\/Form: screen to add
$form_id= \
\/\/Create section
$section_id= \
$section_args= array(
\
\
);
$wp_fields->add\u section ($object\u type, $section\u ID, $object\u name, $section\u args);
}Now that you have the form section, you must add fields here. To do this, you can use the add_field() method: The
\/\/Add field
$field_id= \
\/\/Set field
$field_args= times