When I download and install the sage theme, the comment replies don’t work. When I click on Reply on a comment, it doesn’t move the comment form to the proper position and I get this error in the console:
Uncaught ReferenceError: addComment is not defined
at HTMLAnchorElement.onclick ((index):181)
onclick @ (index):181
Line 181 in index is this:
<div class="reply"><a rel='nofollow' class='comment-reply-link' href='#comment-101175' onclick='return addComment.moveForm( "div-comment-101175", "101175", "respond", "14898" )'>
I checked the history and it was removed in this commit (9.0.0-alpha.1: August 30th, 2016) but it doesn’t say why: https://github.com/roots/sage/commit/d217ba6
I was able to fix for myself by adding it back here:
/**
* Theme assets
*/
add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('sage/main.css', asset_path('styles/main.css'), false, null);
wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery'], null, true);
wp_enqueue_script( 'comment-reply' ); // this fixes comment replies
}, 100);
Can anyone please elaborate on why was this removed? Is this a bad practice? What’s the best way to fix it then?