Title: Adding Link to Comments to TOC
Last modified: January 9, 2024

---

# Adding Link to Comments to TOC

 *  Resolved [mprprojects](https://wordpress.org/support/users/mprprojects/)
 * (@mprprojects)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-link-to-comments-to-toc/)
 * Hello, is there a way to add the navigation (previous/next post) and the comments
   section to the table of contents?
 * Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Zeba Afia Shama](https://wordpress.org/support/users/zebaafiashama/)
 * (@zebaafiashama)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-link-to-comments-to-toc/#post-17332215)
 * Hello @[mprprojects](https://wordpress.org/support/users/mprprojects/) 
   I hope
   you are doing well.I am sorry to disappoint you but currently, the Table of Contents
   doesn’t have the navigation and comments sections feature right now.
 * With that being said, there are existing feature requests, so I’ve added your
   vote to our internal suggestion lists. If your suggestions are something that
   we’re able to introduce, we’ll be sure to let you know.
 * If you have any further questions, please let us know.
   Thank You
 *  Thread Starter [mprprojects](https://wordpress.org/support/users/mprprojects/)
 * (@mprprojects)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-link-to-comments-to-toc/#post-17354361)
 * Ok, I see. Thanks for your reply. For anybody who’s interested, as a temporary
   fix I did the following:
    - In my post template I added a html anchor “post_navigation” to the navigation
      block and another anchor “post_comments” to the ‘Comments’ text block.
    - In function `generate_toc` in file `wp-content/plugins/table-of-contents-block/
      includes/helpers.php` I added the following before the return statement (`
      return $toc`):
 *     ```wp-block-code
       $toc .= "<ul style=\"list-style-type: none;\">";        $toc .= "<li><a href=\"#post_navigation\">Post Navigation</a></li>";
       $toc .= "<li><a href=\"#post_comments\">Comments</a></li>";
       $toc .= "<li><a href=\"#respond\">Create Comment</a></li>";
       $toc .= "</ul>";
       ```
   
 * That works fine for my purpose.
 *  [Ashikur Rahman](https://wordpress.org/support/users/ashikurwp/)
 * (@ashikurwp)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/adding-link-to-comments-to-toc/#post-17360374)
 * Hello @[mprprojects](https://wordpress.org/support/users/mprprojects/) ,
   Greetings.
   Thanks a lot for sharing the details. Your cooperation is greatly appreciated.
   We will forward this query to the DEV team, and if possible, we will add this
   for future improvements.Best regards

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Adding Link to Comments to TOC’ is closed to new replies.

 * ![](https://ps.w.org/table-of-contents-block/assets/icon-256x256.png?rev=2664424)
 * [Table Of Contents Block](https://wordpress.org/plugins/table-of-contents-block/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/table-of-contents-block/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/table-of-contents-block/)
 * [Active Topics](https://wordpress.org/support/plugin/table-of-contents-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/table-of-contents-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/table-of-contents-block/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Ashikur Rahman](https://wordpress.org/support/users/ashikurwp/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/adding-link-to-comments-to-toc/#post-17360374)
 * Status: resolved