[Support request] create custom template

Home Forums Support [Support request] create custom template

Home Forums Support create custom template

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1333517
    Hilton

    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.

    #1333870
    David
    Staff
    Customer Support

    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

    #1334408
    Hilton

    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'); ?>

    #1334756
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Does comments-recipe.php exist in your child theme?

    The code should look like this:

    <?php comments_template('comments-recipe.php'); ?>

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.