I just created a comments.php file inside my WordPress theme folder and I customized some fields. My main purpose was to use Bootstrap 4's input groups. When I call the comments using the code piece below, everything is OK:
<?php
if (comments_open()) :
comments_template();
else :
echo '<p>You cannot send comments for this post.</p>';
endif;
?>
But in another section of my website I need the WordPress comment_form()
inside a Bootstrap 4 Modal. When I call the comment_form()
there, I get the original WordPress Comment From instead of the form that I created (or better to say modified) on my own.
Here's my code:
<div class="modal fade" id="commenting">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Post your comment</h4>
<button type="button" class="close ml-0" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<?php
comment_form();
?>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>