Enable Threaded Comments in your WordPress Theme
Threaded Comments are a great way to visually show direct replies to comments. When a person replies to a comment already on your site, the reply will display indented underneath the original comment. To enable Threaded Comments in your theme, simply add the following lines to your functions.php file:
add_action('get_header', 'enable_threaded_comments'); function enable_threaded_comments() { if (!is_admin()) { if (is_singular() && comments_open() && (get_option('thread_comments') == 1)) wp_enqueue_script('comment-reply'); } }
Now you will be able to see Threaded Comments wherever comments are shown on your theme.
Muskie says
I added this to my functions.php as part of my upgrading my blog and theme to WordPress 5.0.2 and it doesn’t quite work. I can leave a comment and old comments can be threaded that were left while I was running DISQUS. I have to remove DISQUS for speed and because it is blocked in China so I’m trying to make native WordPress plugins work. What else could be causing this? I get this error in the console to:
ReferenceError: Can’t find variable: addComment