In the comments section of Disqus in Genesis article, a couple of users asked how the standard WordPress comments can be loaded on demand.
In this tutorial we are going to look into how comments section (comments list and comment form) in Genesis can be hidden on singular pages (typically, Posts) by default. The comments section will smoothly fade in to view when a "Show Comments" button is clicked. When the comments section is visible, we shall change the button's label to "Hide Comments" which works as one would expect.
When "Show Comments" button is clicked, comments section will appear below and the button's label changes to "Hide Comments".
This tutorial only covers showing the comments section on demand, not loading it (dynamically fetching) on click. If you are interested in true dynamic loading, follow this tutorial instead.
Create a file named say, singular.js in your child theme's js directory having the following:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.