最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Why is comments_template() working without a comments.php file?

programmeradmin14浏览0评论

I want to be able to style the comments section to work with the theme I am building. I do not have a comments.php file in the website however when I include:

<?php if ( comments_open() || get_comments_number() ) :
            comments_template();
        endif;

?>

I get a full comments section under my post, being able to add and view comments and commenters info. I thought that when I include the above if statement it was supposed to pull the info from the comments.php file that included all of my html with it.

I now don't know where to view the CSS that is attached to the comment form, except in the Google 'Inspect' section for developers, so that I can alter it.

I looked in the twentynineteen theme and it has my code as well as a very complicated comments.php file. I can't claim to fully understand the comments.php file but I'm confused about how I am getting an output of a comment form and its replies without having to have a comments.php file.

What am I missing? Can someone help clear this up for me?

I want to be able to style the comments section to work with the theme I am building. I do not have a comments.php file in the website however when I include:

<?php if ( comments_open() || get_comments_number() ) :
            comments_template();
        endif;

?>

I get a full comments section under my post, being able to add and view comments and commenters info. I thought that when I include the above if statement it was supposed to pull the info from the comments.php file that included all of my html with it.

I now don't know where to view the CSS that is attached to the comment form, except in the Google 'Inspect' section for developers, so that I can alter it.

I looked in the twentynineteen theme and it has my code as well as a very complicated comments.php file. I can't claim to fully understand the comments.php file but I'm confused about how I am getting an output of a comment form and its replies without having to have a comments.php file.

What am I missing? Can someone help clear this up for me?

Share Improve this question edited Jun 28, 2019 at 18:23 Niall asked Jun 28, 2019 at 18:01 NiallNiall 271 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 4

If in the root of the folder of your theme there is no file "comments.php". Than comments_template () include the file from the path "/wp-includes/theme-compat/comments.php".
To make changes in that file you can copy "comments.php" from this folder to the root of your theme. And then change as you like.

发布评论

评论列表(0)

  1. 暂无评论