Archived topic
create custom template
3 replies · Started by Hilton on June 18, 2020
Hello, I created a template for single.php with the name single-recipes.php (on a child theme).
In line 21 I changed it to get_template_part ('content', 'single-recipes'), and created the content-single-recipes.php template.
How can I do with the comments.php file so that I can create comments-recipes.php and make references to it in the single-recipes.php?
As it is a recipe template, I need to make some changes.
Hi there,
you can edit the comments_template() callback in your single-recipes template to include your new comments-recipes.php
See the Codex example here:
https://developer.wordpress.org/reference/functions/comments_template/#user-contributed-notes
Hi David,
I tried to edit but I must be doing something wrong because it is not working. My comments-recipes.php file is inside the child theme folder, so I edited it by adding the following, but it didn't work ...
<? Php comments_template ('/comments-recipe.php'); ?>
Hi there,
Does comments-recipe.php exist in your child theme?
The code should look like this:
<?php comments_template('comments-recipe.php'); ?>