How to add custom metaboxes to posts and custom post types in wordpress?
Want to insert custom meta boxes in posts, pages, and in
custom post types on WordPress? These meta boxes are usually needed to add
custom fields (metadata) to the content, i.e. to provide a better user
interface. In this article I will tell you what a custom meta box is and how to
easily add it to posts and to the custom post type in WordPress.
Click here : Website
Designing Services UAE
How to insert a custom metabox into a record
What Is A Custom Meta Box?
A custom meta box is a more convenient interface for adding
custom fields (metadata) to posts, pages, and other custom post types.
WordPress has an extremely easy to use interface that helps
you create content such as posts and pages or custom post types.
Typically, each type of content consists of actual content
and its metadata. Metadata is information related to content, such as: date and
time of publication, author’s name, title, etc. You can also add your metadata
using custom fields.
Custom metadata fields
However, adding metadata through standard custom fields is
not such a simple and intuitive task. And here user meta boxes come to the
rescue.
WordPress allows web developers to create and add their own
metaboxes to the post editing screen.
And here is how the most popular plugins add different
options to the record editing screen. For example, this is what a custom meta
box looks like - SEO title and meta description from Yoast SEO plugin :
Custom metabox plugin Yoast Seo
Having said all this, let's finally find out how easy it is
to add a custom meta box to WordPress posts and a custom post type.
Creating a Custom Meta Box
Install and activate the Advanced Custom Fields plugin. For
more information, read the step-by-step instructions on how to install the
plugin on WordPress .
After activation, the plugin will add a new item in the
administration panel menu - “User fields”. Click on it and you will be taken to
the custom fields page.
Since you have not created anything yet, this page will be
blank. To fix this, click on the "Add New" button.
Create A New Custom Metabox
You will be taken to the "Add a new field group"
page.
Enter a title for the field group. This title will be used
as the name of your meta box.
After that you can start adding fields. To do this, simply
click on the "+ Add Field" button.
Add a new field to the group
A field setup form will appear. Specify a label name for the
field. This shortcut will be displayed in the box next to the box.
Specify a shortcut for the metadata field
After that, select the field type. The Advanced Custom
Fields plugin provides a number of types: text, text field, radio buttons,
check boxes, the full WYSIWYG editor, images, etc.
Provide instructions for the field that will help users
understand what to write in the field.
Below you will see other options for the fields. Study them
carefully and customize these options to suit your needs.
Other custom field options
Click on the “Close field” button to collapse the field.
If you need to add more fields to the meta box, then repeat
the process - click the "+ Add field" button to add another field,
and so on every time.
If necessary, add more fields
After you finish adding the fields, scroll down to the
"Location" section. Here you can specify when and where your meta box
will be displayed.
The place where and when the metabox will be indicated
The Advanced Custom Fields plugin comes with some predefined
rules from which you can choose. For example, you can select post types, post
categories, taxonomy, parent page, etc.
Then go the settings for meta boxes.
First you need to choose a serial number, i.e. the order in
which fields are displayed. This means: if you have several groups of fields
defined for one location, then you can select a number to display them. If you
do not know what number to put, then leave the number 0.
Display order of arbitrary fields
Determine the position of the meta box on the page. You can
choose: display the meta box after the content, before the content or in the
right column.
Then select the style for the meta box: standard, i.e. the
same as all other meta boxes in WordPress, or you can choose it seamlessly
(without meta boxes).
If you are not sure what to choose, then leave the Standard
option (WP Metabox).
Finally, you will see a list of fields that are usually
displayed on the record editing screen. If you want to hide certain fields from
this screen, then check the box next to these fields. If you are not sure what
to hide and what not to, then it is better to leave everything unchanged, i.e.
nothing to highlight. After you finish editing, click on the
"Publish" button.
Publishing created metabox
Congratulations! You have just successfully created a meta
box for posts in WordPress.
Depending on the selected settings, you can look into a
record or a custom record type to see how the created meta box looks and works
in reality.
How the created metabox works
You can use the meta box to add metadata to posts or to a
custom post type. This data will be saved in the WordPress database when you
post or save the post.
For more information visit our website Digital Marketing Services in UAE
กระสอบทรายตั้งพื้น กระสอบทราย ไม่ว่าจะใช้เพื่อการออกกำลังกาย ออกอาวุธแบบฉบับชกมวย ซ้อมมวย ซ้อมเทควันโด
ReplyDeleteกระสอบทราย กระสอบทรายตั้งพื้น
ออกกำลังกายลดน้ำหนัก หรือหากิจกรรมสนุก ๆ ยามว่าง กระสอบทรายตั้งพื้น Monster Punch คือคำตอบ .