For most users, we highly recommend using the built-in Template Editor to create your own templates. It gives you an easy interface for editing all blocks and you have the ability to edit HTML and CSS directly as well.
Advanced users can also create their own template files like this:
Creating a Custom Template in your (child) theme
WP Recipe Maker will look for templates in the /wprm-templates/recipe/
folder of your (child) theme, so you can create that directory structure and add templates there. It’s best to use a child theme, to prevent theme updates from overwriting your template.
So to start a custom template from scratch you’d follow these steps:
- Create the
/wprm-templates/recipe/
directory structure in your child theme - Create a “my-custom-template” folder inside
- Inside the
/wprm-templates/recipe/my-custom-template/
folder, add the following files:- my-custom-template.html
- my-custom-template.css
Take note that the folder, HTML and CSS files need to have the exact same name.
You can find our default templates in the /wp-recipe-maker/templates/recipe/modern/
folder if you want to use them as a starting point.
Make a custom template editable in the Template Editor
You can create a custom template that’s also editable in the Template Editor.
For the HTML: any recipe shortcode you add here will automatically be an editable block.
For the CSS: we use comments to define template properties. Take a look at the CSS files in the /wp-recipe-maker/templates/recipe/modern/
folder for examples of the properties you can use!
I need to be able to use PHP in my custom template!
Instead of an HTML file you could also have a PHP file for the recipe template. In that case, your template will only be available in Legacy Mode, and will not be editable in the Template Editor.
We recommend using PHP to create a custom shortcode and adding that to a modern template instead.