• Resolved worksfather

    (@worksfather)


    Hello,

    I am currently developing a wordpress theme and I have a problem with comments. In fact, I would like to add a comment form to a template I created. But when I add <?php comment_form(); ?> nothing is displayed in front-end.

    However I inserted the same code in my front-page.php and the form is displayed very well.

    I also tried with <?php comments_template(); ?> and it only displays the div#comments.

    Can someone help me, please?

    For info, I named my template music.php and placed it in the /page-templates folder.

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi there @worksfather,

    Hope you are doing well.
    The first thing that I would check is if the post is picking the right template by adding a die('some message')into the template file.

    The second thing that I would check is if the comments for the post are open. Remember that the comment_form() method will do nothing if comments are closed.

    Hope this helps to spot the issue. Please keep me posted.

    Cheers

    • This reply was modified 5 years, 7 months ago by sjaure.
    Thread Starter worksfather

    (@worksfather)

    Thanks for your quick answer @sjaure.

    On the first point, I don’t know exactly what you mean, but everything seems to be working well. Because the page displays very well. It is only the comment form that is not displayed.

    On the second point, I verified and comments are open. And it works very well on front-page.php. So, I’m lost

    Sorry I wasn’t clear. In the first point I mean if you are 100% sure that the template that you are modifying is actually the template that you are seeing in the front-end. I mean, are the modifications that you introduce in the file reflected in the front end? I just want to rule out this simple issue.

    For the second point, I understand that you are using this template for a page.
    Remember that comments are disabled in pages by default, even when the comments are enabled for the site. Make sure that comments are allowed for the specific page.
    Check this screenshot for further clarification https://ibb.co/cGFQee

    Thread Starter worksfather

    (@worksfather)

    Ohhhh thank you so much. It works !!! Comments were really not enabled at the page level.

    Thank you for your help. I’ve been looking all day. But it was very simple. I feel stupid :). I never knew that comments are also activated in the dashboard when publishing.

    Really, thank you. I will therefore mark the subject “resolved”.

    Thread Starter worksfather

    (@worksfather)

    Thank you @sjaure

    You’re welcome! Glad to help!
    And don’t feel bad, most of the issues seems silly after you figure it out 😉

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Template development : Comment form not display’ is closed to new replies.