If you’re familiar with HTML, CSS and PHP it’s easy to code your own custom template to use for your recipes.


WP Recipe Maker will look for templates in the /wprm-templates/recipe/ folder of your (child) theme, so just add any template as a folder there. The best place to put a custom template is in your child theme, to prevent plugin or theme updates from overwriting your template.

Take a look at the /wp-recipe-maker/templates/recipe/simple/ template as a starting point and make sure to stick to the naming conventions.

For a template “my-custom-template” you need the following files in the /wprm-templates/recipe/my-custom-template/ folder of your child theme:

  • my-custom-template.php – HTML output for the recipe template
  • my-custom-template.min.css – CSS for the recipe template (preferably minified)
  • my-custom-template.png or .jpg – Optional screenshot for the settings page (500 by 400)

For accessing the recipe fields you have the $recipe object available. An overview of all the available functions can be found in the /wp-recipe-maker/includes/public/class-wprm-recipe.php file.

Getting Started

If you don’t already have a child theme on your website you should start by creating one. A child theme makes sure that any changes you make do not get overwritten when you update your theme.

An easy way to create a child theme is to use the Child Theme Configurator plugin. After installing that you can follow the steps on the Tools > Child Themes page to create one. The default values will most likely be fine.

Once you have a child theme you’ll also have to activate it on the Appearance > Themes page.

This step can be done from the WordPress backend with a plugin like WP Editor but is probably easier through FTP or a File Manager.

To start, you’ll want to create this folder structure in your child theme: /wprm-templates/recipe/

This is where you can put any custom recipe templates.

While starting from scratch is possible, it will be easier to copy one of the existing template folders into the above directory. Our templates can be found in the /templates/recipe/ folder of the plugin.

For example:
Copy the /wp-content/plugins/wp-recipe-maker/templates/recipe/simple/ folder and put it in your child theme so you end up with /wp-content/themes/your-child-theme/wprm-templates/recipe/simple/

Any changes you make to the recipe template files in this folder will now be reflected on your website.

Now that you’ve got your own custom template you can make changes to it. For example, if you copied the “simple” template:

In the simple.php file you can change the HTML of the recipes.

In the simple.min.css file you can change the CSS styling. Important: the extension has to be .min.css and not just .css for the file to load.

The simple.scss file is used by us to generate the .min.css file but is not actually required. If you want to make changes here, you’ll have to convert it to regular CSS using something like SassMeister.

If you want to rename the template, make sure the folder and file names remain consistent.

Once you have a custom template it’s easy to change the recipe image size that is being output. Look for the following line of code in the .php file of the template:

<?php echo $recipe->image(); ?>

To get a specific thumbnail size you can pass along the name of that thumbnail:

<?php echo $recipe->image( 'large' ); ?>

Or you can pass along the exact image size you’d like to see:

<?php echo $recipe->image( array( 300, 200 ) ); ?>