When you visit food websites or food blogs, you may find beautiful recipes that are presented professionally. To create these recipes, in addition to using a dedicated recipe plugin, we can also use custom fields and custom post types with Meta Box plugin. In this article, we’re going to learn how to do it step by step.

Tip: a tutorial video is included at the end of this post.

For better illustration, these are examples of recipes that I found on a food blog. And we are going to create the same one:

The recipe on a food blog

Before Getting Started

First of all, you need to install and activate these tools:

  • Core plugin Meta Box (free): a framework that helps you work with custom fields and meta boxes more easily.
  • MB Custom Post Types & Custom Taxonomies (free): this is an extension to create custom post types for posting recipes easily and quickly. It can run independently without Meta Box plugin.
  • Meta Box Builder (premium): this is an extension that provides us with an intuitive UI right on the back end. It allows you to create custom fields more conveniently with drag and drop actions. To use this extension, you need to install Meta Box plugin first.
  • MB Views: this is an extension of Meta Box plugin to get and display the custom fields value on the front end without adding code to the theme file.
  • eStar theme: this free WordPress theme has hooks that help you display custom fields on the front end easily and conveniently.

In addition, you can use free tools Post Type Generator and Online Generator to create custom post types and custom fields without installing the two above extensions. Read the documentation of Post Type Generator here and the documentation of Online Generator here.

After you had all the needed tools, follow these steps below to create a recipe with Meta Box plugin:

Step 1: Create the Custom Post Type Recipe and Its Custom Fields

First, I will create the Recipe custom post type for posting recipes.

Read more: How to create a custom post type in WordPress using code and plugin?

Go to Meta Box > Post Types > New Post Types:

Create the Recipe custom post type for posting recipes with Meta Box plugin.

I created the Recipe post type with the following information:

Created the Recipe post type with Meta Box plugin.

As you can see at the beginning, a recipe usually has items such as preparation time, cooking time, equipment, ingredients, instruction, notes, nutrition, etc. To add these items, I will create the corresponding custom fields Prep time, Cook time, Resting time, Total time, Equipment, Ingredients, Instructions,… for the Recipe post type.

Go to Meta Box > Custom Fields > Add New to create new custom fields for the recipe. The fields are created with the following field types and field names:

Field Name Field Type
Prep time text
Cook time text
Resting time text
Total time text
Ingredients wysiwyg
Instructions wysiwyg
Video text
Notes wysiwyg
Nutrition wysiwyg
Equipment wysiwyg

Read more: How to Add and Configure Custom Fields Using Meta Box Builder.

These are the fields that I’ve created:

The custom fields for the recipe post type

Upon creating fields, move to the Settings tab and choose the post type as recipe:

Choose the post type as recipe

Ok, now we have the recipe custom post type with all the needed custom fields.

Next, go to Recipe > Add Recipe:

Add a new recipe

After that, drag to the bottom, you can see the custom fields that we’ve created for the recipe post type. You need to fill in these fields. For example, I enter the pizza recipe as follows:

Fill in the custom fields for the food recipe

We’ve filled in the information for the custom fields, but the recipe still hasn’t been displayed on the WordPress website yet:

the recipe still hasn’t been displayed on the WordPress website yet

Therefore, we need to get the custom fields’ values and display them on the front end of the WordPress website.

Step 2: Display the Custom Fields’ Data on the Front End

I will display the custom fields in a hook of eStar theme that is ‘estar_entry_footer_before’. Refer to this hook here.

To get and display the custom fields’ value on the front end, there are two methods:

  • Method 1: Add code to the theme file
  • Method 2: Use MB Views extension

Method 1: Add Code to the Theme File

Add the following code to the functions.php of the theme:

add_action( 'estar_entry_footer_before', 'estar_child_recipe' );
function estar_child_recipe() {
	if ( ! is_singular( 'recipe' ) ) {
		return;
	}
	$ingredients = rwmb_meta( 'ingredients' );
	$instructions = rwmb_meta( 'instructions' );
	$equipment = rwmb_meta( 'equipment' );
	$video = rwmb_meta( 'video' );
	$notes = rwmb_meta( 'note' );
	$nutrition = rwmb_meta( 'nutrition' );
	$prep_time = rwmb_meta( 'prep_time' );
	$cook_time = rwmb_meta( 'cook_time' );
	$resting_time = rwmb_meta( 'resting_time' );
	$total_time = rwmb_meta( 'total_time' );
	?>
	<div class="recipe-food__container">
		<h2 class="recipe-name">Recipe</h2>
		<div class="recipe-group recipe-times">
			<h3 class="recipe-header">
				<div class="recipe-line"></div>
			</h3>
			<div class="recipe-times__container">
				<div class="recipe-times__item">
					<span class="label">Prep Time</span>
					<span class="recipe-time"><?php echo $prep_time; ?></span>
				</div>
				<div class="recipe-times__item">
					<span class="label">Cook Time</span>
					<span class="recipe-time"><?php echo $cook_time; ?></span>
				</div>
				<div class="recipe-times__item">
					<span class="label">Resting Time</span>
					<span class="recipe-time"><?php echo $resting_time; ?></span>
				</div>
				<div class="recipe-times__item">
					<span class="label">Total Time</span>
					<span class="recipe-time"><?php echo $total_time; ?></span>
				</div>
			</div>
		</div>
		<div class="recipe-group recipe-equipment">
			<h3 class="recipe-header">
				Equipment
				<div class="recipe-line"></div>
			</h3>
			<?php echo do_shortcode( wpautop( $equipment ) ); ?>
		</div>
		<div class="recipe-group recipe-ingredients">
			<h3 class="recipe-header">
				Ingredients
				<div class="recipe-line"></div>
			</h3>
			<?php echo $ingredients; ?>
		</div>
		<div class="recipe-group recipe-instructions">
			<h3 class="recipe-header">
				Instructions
				<div class="recipe-line"></div>
			</h3>
			<?php echo $instructions; ?>
		</div>
		<div class="recipe-group recipe-video">
			<h3 class="recipe-header">
				Video
				<div class="recipe-line"></div>
			</h3>
			<?php echo wp_oembed_get( $video ); ?>
		</div>
		<div class="recipe-group recipe-notes">
			<h3 class="recipe-header">
				Notes
				<div class="recipe-line"></div>
			</h3>
			<?php echo $notes; ?>
		</div>
		<div class="recipe-group recipe-nutrition">
			<h3 class="recipe-header">
				Nutrition
				<div class="recipe-line"></div>
			</h3>
			<?php echo $nutrition; ?>
		</div>
	</div>
	<?php
}

The above code is to display the custom fields’ data on the front end, in the ‘estar_entry_footer_before’ hook.

Explanation:

  • ‘estar_child_recipe' is the function name, you can set it on a whim.
  • 'ingredients' , 'instructions' , 'equipment' , 'video' , 'note' , 'nutrition' , 'prep_time' , 'cook_time' , 'resting_time', 'total_time' are the IDs of custom fields.

Method 2: Use MB Views Extension

If you don’t want to touch the theme files, you can use MB Views extension of Meta Box plugin.

First, go to Meta Box > Views > Add New:

Next, add the following code in the Template tab:

{% set ingredients = mb.rwmb_meta( 'ingredients' ) %}
{% set instructions = mb.rwmb_meta( 'instructions' ) %}
{% set equipment = mb.rwmb_meta( 'equipment' ) %}
{% set video = mb.rwmb_meta( 'video' ) %}
{% set notes = mb.rwmb_meta( 'note' ) %}
{% set nutrition = mb.rwmb_meta( 'nutrition' ) %}
{% set prep_time = mb.rwmb_meta( 'prep_time' ) %}
{% set cook_time = mb.rwmb_meta( 'cook_time' ) %}
{% set resting_time = mb.rwmb_meta( 'resting_time' ) %}
{% set total_time = mb.rwmb_meta( 'total_time' ) %}

<div class="recipe-food__container">
	<h2 class="recipe-name">Recipe</h2>
	<div class="recipe-group recipe-times">
		<h3 class="recipe-header">
			<div class="recipe-line"></div>
		</h3>
		<div class="recipe-times__container">
			<div class="recipe-times__item">
				<span class="label">Prep Time</span>
				<span class="recipe-time">{{ prep_time }}</span>
			</div>
			<div class="recipe-times__item">
				<span class="label">Cook Time</span>
				<span class="recipe-time">{{ cook_time }}</span>
			</div>
			<div class="recipe-times__item">
				<span class="label">Resting Time</span>
				<span class="recipe-time">{{ resting_time }}</span>
			</div>
			<div class="recipe-times__item">
				<span class="label">Total Time</span>
				<span class="recipe-time">{{ total_time }}</span>
			</div>
		</div>
	</div>
	<div class="recipe-group recipe-equipment">
		<h3 class="recipe-header">
			Equipment
			<div class="recipe-line"></div>
		</h3>
		{{ mb.wpautop( equipment ) }}
	</div>
	<div class="recipe-group recipe-ingredients">
		<h3 class="recipe-header">
			Ingredients
			<div class="recipe-line"></div>
		</h3>
		{{ ingredients }}
	</div>
	<div class="recipe-group recipe-instructions">
		<h3 class="recipe-header">
			Instructions
			<div class="recipe-line"></div>
		</h3>
		{{ instructions }}
	</div>
	<div class="recipe-group recipe-video">
		<h3 class="recipe-header">
			Video
			<div class="recipe-line"></div>
		</h3>
		{{ mb.wp_oembed_get( video ) }}
	</div>
	<div class="recipe-group recipe-notes">
		<h3 class="recipe-header">
			Notes
			<div class="recipe-line"></div>
		</h3>
		{{ notes }}
	</div>
	<div class="recipe-group recipe-nutrition">
		<h3 class="recipe-header">
			Nutrition
			<div class="recipe-line"></div>
		</h3>
		{{ nutrition }}
	</div>
</div>

After that, scroll down to the Settings section to choose the post type as recipe. You need to choose Singular in the Type section and choose recipe in the Location section.

Whichever method you choose, remember to fill in the right IDs of the custom fields.

Upon finishing, the recipe displays on the WordPress website as follows:

The custom fields’ data is now displayed on the front end. However, the recipe doesn’t look so beautiful. Therefore, I will style it a bit with CSS for better display.

Step 3: Style the Recipe with CSS

Go to Customizer > Additional CSS and add the CSS code. You can refer to my CSS code below:

.recipe-food__container {
	border: 1px solid #E0E0E0;
	padding: 20px;
	background: #b0e4e4;
}
.recipe-food__container p {
	margin-bottom: 5px;
}
.recipe-group {
	margin-bottom: 30px;
}

.recipe-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	font-size: 1.2em;
	text-transform: uppercase;
	margin-bottom: 15px;
}
.recipe-line {
	flex: auto;
	height: 1px;
	border-bottom: 1px solid #e0e0e0;
	margin-left: 15px;
}
.recipe-times .recipe-line {
	margin-left: 0;
}
.recipe-times__container {
	display: flex;
	padding: 5px;
	margin: 5px 0;
}
.recipe-times__item {
	flex: 1;
	display: flex;
	flex-direction: column;
	text-align: center;
}
.recipe-times__item .label {
	text-transform: uppercase;
	opacity: 0.6;
}

Now my pizza recipe looks much more delicious and beautiful:

The pizza recipe on the WordPress website

You can see the full-sized recipe here.

Tutorial Video

We made a video for this tutorial, you may want to watch it:

Last Words

As you can see, creating a recipe with Meta Box plugin isn’t difficult. We just need to create custom post types, custom fields and display them on the front end, everything is quite easy.

Depending on the needs of the website owner, the recipe will have other items. You just need to add or remove custom fields accordingly to fit your requirements. I hope your food blog will be successful. If you have any questions about custom fields and meta boxes, leave a comment or join the Meta Box Users Facebook group!

In addition, some WordPress themes display your food and recipes beautifully and attractively, discover them here.

Other case studies you might be interested in

  1. Create A Dynamic Landing Page in WordPress Using Custom Field
  2. Create a Filter to Find Hotels by Location
  3. Create an OTA Website Like Booking.com with Meta Box Plugin - P1: Create a Page to Introduce Hotel Rooms
  4. Create an OTA Website Like Booking.com with Meta Box Plugin - P2: Create Filters on the Archive Page
  5. Create an OTA Website Like Booking.com with Meta Box Plugin - P3: Create Filters for Single Hotel Pages
  6. Create Dynamic Favicon in WordPress using Meta Box plugin
  7. Create Posts Series in WordPress Using Meta Box
  8. Display The Latest Products Section - P2 - Using Meta Box and Elementor
  9. Display The Latest Products Section - P3 - Using Meta Box And Oxygen
  10. How to Add Custom Fields for WooCommerce - P2 - Using MB Views
  11. How to Add Custom Fields to Display Banners using Meta Box Plugin
  12. How to Add Guest Authors and Guest Posts - Using Meta Box
  13. How to Add Related Posts - Using Custom Fields
  14. How to Build a Hotel Booking Website Using Meta Box - P1
  15. How to Build a Hotel Booking Website Using Meta Box - P2 - Booking Page in Backend
  16. How to Build a Hotel Booking Website Using Meta Box - P4 - Booking Management Page
  17. How to Build a Hotel Booking Website Using Meta Box – P3 – Booking Page for Customer
  18. How to Create a Classified Ads Website using Meta Box
  19. How to Create a Custom 404 Page in WordPress - P1 - Using Meta Box and Elementor
  20. How to create a FAQs page - P5 - Using Meta Box and Breakdance
  21. How to Create a Product Page - P2 - Using Meta Box and Oxygen
  22. How to Create a Product Page - P3 - Using Meta Box and Bricks
  23. How to Create a Product Page - P4 - Using Meta Box and Elementor
  24. How to Create a Product Page - P5 - Using Meta Box and Gutenberg
  25. How to Create a Product Page - P6 -Using Meta Box and Breakdance
  26. How to Create a Product Page - P7 - Using Meta Box + Kadence
  27. How to Create a Product Page - P8 - Using Meta Box and Brizy
  28. How to Create a Product Page - P9 - Using Meta Box and Divi
  29. How to Create a Product Page using Meta Box Plugin
  30. How to Create a Reading Progress Bar in WordPress Posts - P1 - Using MB Views
  31. How to Create a Recipe - P2 - Using Meta Box and Oxygen
  32. How to Create a Recipe - P3 - Using Meta Box and Elementor
  33. How to Create a Recipe - P4 - Using Meta Box and Bricks
  34. How to Create a Recipe - P5 - Using Meta Box and Zion
  35. How to Create a Recipe - P6 - Using Meta Box and Brizy
  36. How to Create a Recipe - P7 - Using Meta Box and Breakdance
  37. How to Create a Recipe - P8 - Using Meta Box and Kadence
  38. How to Create a Recipe - P9 - Using Meta Box and Divi
  39. How to Create a Recipe with Meta Box Plugin
  40. How to Create a Simple Listing - P2 - Using Meta Box and Bricks
  41. How to Create a Simple Listing - P3 - Using Meta Box and Breakdance
  42. How to Create a Simple Listing - P4 - Using Meta Box and Elementor
  43. How to Create a Simple Listing - P5 - Using Meta Box and Kadence
  44. How to Create a Team Members Page - P1- Using Meta Box and Elementor
  45. How to Create a Team Members Page - P2 - Using Meta Box and Oxygen
  46. How to Create a Team Members Page - P3 - Using Meta Box and Bricks
  47. How to Create a Team Members Page - P4 - Just Meta Box
  48. How to Create a Team Members Page - P6 - using Meta Box and Breakdance
  49. How to Create a Team Members Page - P7 - Using Meta Box and Kadence
  50. How to Create a Video Gallery Page - P2 - Using Meta Box + Bricks
  51. How to Create a Video Gallery Page - P3 - Using Meta Box and Breakdance
  52. How to Create a Video Gallery Page - P4 - Using Meta Box + Elementor
  53. How to Create a Video Gallery Page - P5 - Using MB Views
  54. How to Create a Video Gallery Page - P6 - Using Meta Box and Zion
  55. How to Create a Video Gallery Page - P7 - Using Meta Box and Kadence
  56. How to Create a Video Gallery Page Using Meta Box + Oxygen
  57. How to Create ACF Flexible Content Field with Meta Box
  58. How to Create an Auto-Updated Cheat Sheet in WordPress
  59. How to Create an FAQs Page - P1 - Using Meta Box and Elementor
  60. How to create an FAQs page - P2 - Using Meta Box and Oxygen
  61. How to create an FAQs page - P4 - Using Meta Box and Bricks
  62. How to Create an FAQs Page - P6 - Using MB Views
  63. How to Create an FAQs Page - P7 - Using Meta Box and Divi
  64. How to Create an FAQs Page - P8 - Using Meta Box and Kadence
  65. How to Create an FAQs Page - P9 - Using MB Blocks
  66. How to Create an FAQs Page -P3- Using Meta Box
  67. How to Create Buttons with Dynamic Link using Custom Fields
  68. How to Create Category Thumbnails & Featured Images Using Custom Fields
  69. How to Create Download and Preview Buttons - P1 - Using Meta Box and Bricks
  70. How to Create Download and Preview Buttons - P2 - Using Meta Box and Oxygen
  71. How to Create Download and Preview Buttons - P3 - Using MB Views
  72. How to Create Download and Preview Buttons - P4 - Using Meta Box and Kadence
  73. How to Create Download Buttons in WordPress - Using Custom Fields
  74. How to Create Dynamic Landing Page in WordPress - P1 - Using Meta Box and Elementor
  75. How to Create Dynamic Landing Page in WordPress - P2 - Using Meta Box and Bricks
  76. How to Create Menus for Restaurants - P1 - Using Meta Box and Elementor
  77. How to Create Menus for Restaurants - P2- Using Meta Box and Bricks
  78. How to Create Notification Using Custom HTML Field
  79. How to Create Online Admission Form for School or University
  80. How to Create Online Reservation Form for Restaurants using Meta Box
  81. How to Create Reading Time to Your WordPress Posts - Using MB Views
  82. How to Create Relationships - P1 - Using Meta Box and Oxygen
  83. How to Create Relationships - P2 - Using Meta Box and Bricks
  84. How to Create Relationships - P3 - Using MB Views
  85. How to Create Relationships - P4 - Using Meta Box and Breakdance
  86. How to Create Taxonomy Thumbnails & Featured Images - P2 - Using Meta Box and Oxygen
  87. How to Create Taxonomy Thumbnails & Featured Images - P3 - Using Meta Box and Bricks
  88. How to Create Taxonomy Thumbnails & Featured Images - P4 - Using MB Views
  89. How to Create YouTube Video Timestamps on WordPress Website - P1 - Using MB Views
  90. How to Display a Video Playlist - P1- Using MB Views
  91. How To Display All Listings On A Map With Meta Box
  92. How to Display Author Bio in WordPress - P1 - Using Meta Box and Bricks
  93. How to Display Author Bio in WordPress - P2 - Using MB Views
  94. How to Display Dynamic Banners in WordPress - P3 - Using MB Views
  95. How to Display Images from Cloneable Fields - P1 - with Gutenberg
  96. How to Display Images from Cloneable Fields - P2 - Using Meta Box and Oxygen
  97. How to Display Images from Cloneable Fields - P3 - with Elementor
  98. How to Display Images from Cloneable Fields - P4 - with Bricks
  99. How to Display Opening Hours for Restaurants - P1 - Using Meta Box + Gutenberg

1 thought on “How to Create a Recipe with Meta Box Plugin

Leave a Reply

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