Have you ever had a regularly updated cheat sheet on a page or post, but you do not want to manually edit it anymore? I have edited my cheat sheets by hand for Black Friday event. I had to update deal lists several times per day, and that was a true nightmare.
- 1. Video Version:
- 2. Preparation
- 3. Step 1: Create a New Custom Post Type
- 4. Step 2: Create a Submission Form for Importing Data
- 5. Step 3: Display the Submission Form on the Front End
- 6. Step 4: Style the Submission Form
- 7. Step 5: Display Data into a Table on Frontend
- 8. Tutorial Video
- 9. Last Words
Thus, I managed to find a more effective way to add an automatically updated cheat sheet. All I have to do is to create a submission form to input data, then the data will be automatically inserted into a table. This way can display data in a both stunning and convenient way. Let’s see how to do this!
Video Version:
Note: You can use the way I introduce in this post to make various types of submission forms and cheat sheets for:
- Customers’ / partners’ contact management
- Documents / books listing
- Tourist attractions listing
- Staff’s information listing
- Student profiles
- etc
Preparation
You need to install the following tools:
- Meta Box plugin: this is the framework that helps me create custom post types and custom fields. It’s available on wordpress.org.
- MB Custom Post Types & Custom Taxonomies: this plugin is an extension of Meta Box. It gives us a visual interface on the backend to create a custom post type. This plugin is free and available on wordpress.org too. However, if you have bought premium bundles of Meta Box, this plugin is already available in the bundles.
- Meta Box Builder: provide you with a visual interface to create custom fields.
- MB Frontend Submission: display custom fields on the frontend to help users import data from the frontend.
- MB Views: display values of the custom fields on the frontend.
Here all of the 3 tools, Meta Box Builder, MB Frontend Submission, and MB views, are the premium extensions of Meta Box. You will need to buy these plugins, or buy the bundles of Meta Box to get all of them at the best price.
In this post, I will use all of the mentioned tools to add a cheat sheet about the deals for Black Friday I have said. Each deal will have information like this:
- Product Name
- Product Type
- Offer
- Start Date
- End Date
- Promotion Code
Step 1: Create a New Custom Post Type
I need to add a new post type for the data we want to import into the table. Each of the deals will be a post of this post type.
Step 2: Create a Submission Form for Importing Data
I will create a field group for the submission form. Each field will be used to import a type of the deal’s information I have said above.
Name of the Fields | IDs of the Fields | Field types |
Your Product Name | post_title | text |
Your Product Type | product_type | select_advanced |
Your Offer | offer | text |
Start Date | start_date | date |
End Date | end_date | date |
Promotion Code | promotion_code | text |
Here I will use the post_title
field to save product names as the title of the post.
Go to Meta Box > Custom Fields > Add New to create a new field group. Click Add Field and you will see many types of fields to choose. Just go ahead and get what you need.
And these are the fields I have created.
In the Settings tab of this field group, I will choose the location as Post Type and assign these fields to the posts of the Deal post type.
At this time, the fields will show up in the post editor like this:
If you or another employee in your company is in charge of importing data, you can set to import data directly from the backend. Otherwise, if you want other people to import data into your cheat sheet, you need to bring these fields to the frontend.
Step 3: Display the Submission Form on the Front End
We need plugin MB Frontend Submission to display the custom fields of this form to the frontend. This plugin will automatically generate a shortcode for the field group like this.
You just need to put the shortcode into anywhere you want to display the submission form. I will place it into the content of a page like in the image below:
However, here I want to add some more things into my form, so I add some attributes to my shortcode like this:
[mb_frontend_form id="black-friday-deal" ajax="true" post_status="draft" recaptcha_key="your_key" recaptcha_secret="your_key"]
In this code:
black-friday-deal
: Is the ID of the field group I have created in step 2;ajax="true"
: Enable ajax loading;recaptcha_key
andrecaptcha_secret
: Google reCaptcha site key and secret key. I use it to avoid being spammed;your_key
: Fill in the corresponding keys of your Google reCaptcha here;post_status="draft"
: I want the data to be censored before posting so I set up this post in “draft” status right after users have submitted.
And the custom fields of my submission form will show up on the frontend like this:
If you want to add more things to submission forms, you can add other attributes into the shortcode. You can see a list of addable attributes and a detailed instruction here.
Step 4: Style the Submission Form
If you want your form to display more beautifully, you can use CSS to style these fields.
Go to Customizer > Additional CSS and add some CSS like this:
.rwmb-form { background: #e2e8f0; padding: 24px; border-radius: 4px; max-width: 768px; margin: 0 auto; } .rwmb-form .rwmb-meta-box .rwmb-field { padding: 0 5px; } .rwmb-form .rwmb-field:not(:last-of-type) { margin: 0 0 12px; } .rwmb-form .rwmb-label, .rwmb-form .rwmb-field .rwmb-input, .rwmb-form .rwmb-field .select2-container { float: none; width: 100%; margin-bottom: 5px; } .rwmb-form button, .rwmb-form input { width: 100%; } .rwmb-form .rwmb-input input, .rwmb-form .rwmb-input select { max-width: 100%; } .rwmb-form .select2-container .select2-selection--single, .rwmb-form .select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px; } .rwmb-form .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 40px; }
My submission form will turn to this appearance:
Step 5: Display Data into a Table on Frontend
Finally, all I need to do is to get the value of the custom fields in the submission form, and then display them into a table on my post using MB Views.
Go to Meta Box > Views > Add New, and add these codes:
{% set args = {post_type: 'deal', posts_per_page: -1, orderby: 'date', order: 'ASC' } %} {% set posts = mb.get_posts( args ) %} <table> <thead> <tr> <td>No.</td> <td>Name</td> <td>Type</td> <td>Offer</td> <td>Start</td> <td>End</td> <td>Code</td> </tr> </thead> <tbody> {% for p in posts %} <tr> <td>{{ loop.index }}</td> <td>{{ p.post_title }}</td> <td>{{ mb.rwmb_meta( 'your_product_type', '', p.ID ) }}</td> <td>{{ mb.rwmb_meta( 'your_offer', '', p.ID ) }}</td> <td>{{ mb.rwmb_meta( 'start_date', '', p.ID ) | date( 'Y-m-d' ) }}</td> <td>{{ mb.rwmb_meta( 'end_date', '', p.ID ) | date( 'Y-m-d' ) }}</td> <td>{{ mb.rwmb_meta( 'promotion_code', '', p.ID ) }}</td> </tr> {% endfor %} </tbody> </table>
In these lines of code, I use a custom query which is get_posts. The attributes such as post_title
, your_product_type
, your_offer
, … are IDs of custom fields.
In the Settings section of this view, I choose Shortcode as the Type, so that I can use a shortcode to add this table into my post.
I place the shortcode into the content of the post like this:
This is all of the post content on the frontend with a deal list:
So I have finished my cheat sheet! When someone imports data to the submission form, the data will be saved in a post having Deal post type and “draft” status. If I review and approve this content, it will turn to “Published”. At this time, information about the deal will show up right on my post.
Tutorial Video
Last Words
I hope that you can easily imagine and conduct importing and displaying data automatically with this tutorial. As I have said, this method can work well in many cases. If you try it successfully, please share your result with everyone in the comment section. Don’t forget to follow our upcoming tutorials as well! Good luck to you!
Other case studies you might be interested in
- Create A Dynamic Landing Page in WordPress Using Custom Field
- Create a Filter to Find Hotels by Location
- Create an OTA Website Like Booking.com with Meta Box Plugin - P1: Create a Page to Introduce Hotel Rooms
- Create an OTA Website Like Booking.com with Meta Box Plugin - P2: Create Filters on the Archive Page
- Create an OTA Website Like Booking.com with Meta Box Plugin - P3: Create Filters for Single Hotel Pages
- Create Dynamic Favicon in WordPress using Meta Box plugin
- Create Posts Series in WordPress Using Meta Box
- Display a User List On the Frontend with Meta Box
- Display The Latest Products Section - P2 - Using Meta Box and Elementor
- Display The Latest Products Section - P3 - Using Meta Box And Oxygen
- How to Add Custom Fields to Display Banners using Meta Box Plugin
- How to Add Guest Authors and Guest Posts - Using Meta Box
- How to Add Related Posts to WordPress Using Meta Box
- How to Build a Hotel Booking Website Using Meta Box - P1
- How to Build a Hotel Booking Website Using Meta Box - P2 - Booking Page in Backend
- How to Build a Hotel Booking Website Using Meta Box - P4 - Booking Management Page
- How to Build a Hotel Booking Website Using Meta Box – P3 – Booking Page for Customer
- How to Create a Classified Ads Website using Meta Box
- How to create a FAQs page - P5 - Using Meta Box and Breakdance
- How to Create a Product Page - P2 - Using Meta Box and Oxygen
- How to Create a Product Page - P3 - Using Meta Box and Bricks
- How to Create a Product Page - P4 - Using Meta Box and Elementor
- How to Create a Product Page - P5 - Using Meta Box and Gutenberg
- How to Create a Product Page - P6 -Using Meta Box and Breakdance
- How to Create a Product Page - P7 - Using Meta Box + Kadence
- How to Create a Product Page - P8 - Using Meta Box and Brizy
- How to Create a Product Page using Meta Box Plugin
- How to Create a Recipe - P2 - Using Meta Box and Oxygen
- How to Create a Recipe - P3 - Using Meta Box and Elementor
- How to Create a Recipe - P4 - Using Meta Box and Bricks
- How to Create a Recipe - P5 - Using Meta Box and Zion
- How to Create a Recipe - P6 - Using Meta Box and Brizy
- How to Create a Recipe - P7 - Using Meta Box and Breakdance
- How to Create a Recipe with Meta Box Plugin
- How to Create a Simple Listing - P2 - Using Meta Box and Bricks
- How to Create a Team Members Page - P1- Using Meta Box and Elementor
- How to Create a Team Members Page - P2 - Using Meta Box and Oxygen
- How to Create a Team Members Page - P3 - Using Meta Box and Bricks
- How to Create a Team Members Page - P4 - Just Meta Box
- How to Create a Team Members Page - P6 - using Meta Box and Breakdance
- How to Create a Video Gallery Page - P2 - Using Meta Box + Bricks
- How to Create a Video Gallery Page - P3 - Using Meta Box and Breakdance
- How to Create a Video Gallery Page - P4 - Using Meta Box + Elementor
- How to Create a Video Gallery Page - P5 - Using MB Views
- How to Create a Video Gallery Page Using Meta Box + Oxygen
- How to Create ACF Flexible Content Field with Meta Box
- How to Create an Auto-Updated Cheat Sheet in WordPress
- How to Create an FAQs Page - P1 - Using Meta Box and Elementor
- How to create an FAQs page - P2 - Using Meta Box and Oxygen
- How to create an FAQs page - P4 - Using Meta Box and Bricks
- How to Create an FAQs Page -P3- Using Meta Box
- How to Create Buttons with Dynamic Link using Custom Fields
- How to Create Category Thumbnails & Featured Images Using Custom Fields
- How to Create Download and Preview Buttons - P1 - Using Meta Box and Bricks
- How to Create Download and Preview Buttons - P2 - Using Meta Box and Oxygen
- How to Create Download Buttons Using Custom Fields with Meta Box Plugin
- How to Create Menus for Restaurants - P1 - Using Meta Box and Elementor
- How to Create Menus for Restaurants - P2- Using Meta Box and Bricks
- How to Create Online Admission Form for School or University
- How to Create Online Reservation Form for Restaurants using Meta Box
- How to Create Relationships - P1 - Using Meta Box and Oxygen
- How to Create Relationships - P2 - Using Meta Box and Bricks
- How to Create Relationships - P3 - Using MB Views
- How to Create Taxonomy Thumbnails & Featured Images - P2 - Using Meta Box and Oxygen
- How to Create Taxonomy Thumbnails & Featured Images - P3 - Using Meta Box and Bricks
- How to Display Images from Cloneable Fields - P1 - with Gutenberg
- How to Display Images from Cloneable Fields - P2 - with Oxygen
- How to Display Images from Cloneable Fields - P3 - with Elementor
- How to Display Images from Cloneable Fields - P4 - with Bricks
- How to Display Opening Hours for Restaurants - P1 - Using Meta Box + Gutenberg
- How to Display Opening Hours for Restaurants - P2 - Using Meta Box and Oxygen
- How to Display Product Variations - P1 - Using Meta Box and Gutenberg
- How to Display Product Variations - P2 - Using Meta Box and Oxygen
- How to Display Product Variations - P3 - Using Meta Box and Bricks
- How to Display The Latest Products - P5 - Using Meta Box and Bricks
- How to Display the Latest Products - P6 - using Meta Box and Breakdance
- How to Display the Latest Products - P7 - Using Meta Box + Kadence
- How to Display the Latest Products Section - P4 - Using Meta Box + Zion
- How to Display the Most Viewed Posts - P1 - using MB Views
- How to Display the Most Viewed Posts - P2 - using Meta Box and Oxygen
- How to Display the Most Viewed Posts - P3 - Using Meta Box and Bricks
- How to Filter Posts by Custom Fields - P2 - using Meta Box and FacetWP
- How to Manually Reorder Posts with Meta Box
- How to Show Featured Restaurants on Homepage - P1 - Meta Box + Elementor + WP Grid Builder
- How to Show Posts With a Specific Criteria - P3 - Using MB Views
- How to Show Posts with Specific Criteria - P1 - Using Meta Box and Bricks
- How to Show Posts with Specific Criteria - P2 - Using Meta Box and Oxygen
- How to Show Posts with Specific Criteria - P4 - Using Meta Box + Breakdance
- How to Show Posts with Specific Criteria - P5 - Using Meta Box and Elementor
- How to Show the Featured Restaurants - P3 - using Meta Box and Oxygen
- How to Show the Featured Restaurants - P4 - Using MB Views
- How to Show the Featured Restaurants - P5 - Using Meta Box and Elementor
- How to Show the Featured Restaurants - P6 - Using Meta Box and Zion
- How to Show the Featured Restaurants Section - P2 - Using Meta Box and Bricks
- How to Use Custom HTML Field to Output Beautiful Texts or Output Custom CSS