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.

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!

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.

At first, we create a new custom post type for the data which we want to input to the cheat sheet.

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 text
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.

 Click Add Field and you will see many types of fields to choose.

And these are the fields I have created.

Here is the fields I have created for the submission form.

In the Settings tab of this field group, I will choose the location is Post Type and Deal assign these fields to the posts of the Deal post type.

choose the location is Post Type to assign the field to the post type you want

At this time, the fields will show up in the post editor like this:

The fields will show up in the post editor of the chosen post type. Then you can enter data for the cheat sheet here

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.

Use this shortcode to show the submission form on the frontend

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:

Insert the shortcode anywhere you want to put the submission form into

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 and recaptcha_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:

The custom fields of my submission form will show up on the frontend. So, you can input some data for the cheat sheet from frontend.

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:

Use CSS to style the custom fields on the frontend

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.

In the Settings section of this view, I choose Shortcode as the Type.

I place the shortcode into the content of the post like this:

Insert the shortcode to show up custom fields values to anywhere you want

This is all of the post content on the frontend with a deal list:

Here is the cheat sheet with all the data we input into the submission form

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!

Pick Tools for Your Case Studies

Other case studies you might be interested in

  1. Create A Dynamic Landing Page in WordPress Using Custom Field
  2. How to Create ACF Flexible Content Field with Meta Box
  3. How to Create a Product Page using Meta Box Plugin
  4. How to Add Related Posts to WordPress Using Meta Box
  5. How to Create a Classified Ads Website using Meta Box
  6. Create Posts Series in WordPress Using Meta Box
  7. How to Add Guest Author in WordPress using Meta Box (Part 1)
  8. How to Add Guest Author in WordPress using Meta Box (Part 2)
  9. Create Dynamic Favicon in WordPress using Meta Box plugin
  10. How to Build a Hotel Booking Website Using Meta Box - P1
  11. How to Build a Hotel Booking Website Using Meta Box - P2 - Booking Page in Backend
  12. Create a Filter to Find Hotels by Location
  13. How to Build a Hotel Booking Website Using Meta Box – P3 – Booking Page for Customer
  14. How to Create an FAQs Page Using Meta Box
  15. How to Manually Reorder Posts with Meta Box
  16. How to Add Custom JavaScript Actions Using Button Field with Meta Box
  17. Display a User List On the Frontend with Meta Box
  18. How to Build a Hotel Booking Website Using Meta Box - P4 - Booking Management Page
  19. How to Filter Posts by Custom Fields and Custom Taxonomies on Archive Pages
  20. How to Use Custom HTML Field to Output Beautiful Texts or Output Custom CSS
  21. Create an OTA Website Like Booking.com with Meta Box Plugin - P1: Create a Page to Introduce Hotel Rooms
  22. Create an OTA Website Like Booking.com with Meta Box Plugin - P2: Create Filters on the Archive Page
  23. Create an OTA Website Like Booking.com with Meta Box Plugin - P3: Create Filters for Single Hotel Pages
  24. How to Add Custom Fields to Display Banners using Meta Box Plugin
  25. How to Create Download Buttons Using Custom Fields with Meta Box Plugin
  26. How to Create a Recipe with Meta Box Plugin
  27. How to Create an Auto-Updated Cheat Sheet in WordPress
  28. How to Create Online Admission Form for School or University
  29. How to Create Online Reservation Form for Restaurants using Meta Box
  30. How to Create Buttons with Dynamic Link using Custom Fields
  31. How to Create Category Thumbnails & Featured Images Using Custom Fields

Leave a Reply

Your email address will not be published. Required fields are marked *