WordPress Table of Contents Plugin (CMTOC) - How To - Automatically Expand and Collapse Chapters in TOC
How To Automatically Expand and Collapse Chapters in TOC
Note: the feature described in this guide was presented in version 1.6.0.
With the The WordPress Table of Contents plugin it is possible to automatically expand and collapse chapters in TOC while the user scrolls through the relevant chapter in the article. This feature can be applied to either Floating TOC or Sticky Widget.
TIP
Learn more about how to configure Floating TOC and Sticky Widget:
Enabling the Feature
To enable the feature, navigate to Admin Dashboard → CM Table of Contents Pro → Settings → Table of Contents tab.
![Navigation to the plugin settings - WordPress Table of Contents](http://d33v4339jhl8k0.cloudfront.net/docs/assets/558f9e89e4b01a224b42f278/images/66630bfcd593d719515ca453/file-twhWSSsiF7.png)
Under the General Settings section, enable the option Auto expand/collapse sub-chapters, then save the settings.
![Enabling auto expanding/collapsing sub-chapters - Table of Contents WordPress](http://d33v4339jhl8k0.cloudfront.net/docs/assets/558f9e89e4b01a224b42f278/images/66630c445173914f806c1829/file-7fJsN2ijOh.png)
Front-end Examples
Auto expanding and collapsing work a bit differently for Sticky Widget and Floating TOC.
Sticky Widget - in this case it expands and collapses only current sub-chapters of currently viewed chapter or sub-chapter:
![Front-end example - WordPress Table of Contents Block](http://d33v4339jhl8k0.cloudfront.net/docs/assets/558f9e89e4b01a224b42f278/images/666308d5e1989867dcefdb26/file-PomO4OIT5f.gif)
Floating TOC - in this case it expands all sub-chapters of the main chapter:
![Front-end example - Add Table of Contents WordPress](http://d33v4339jhl8k0.cloudfront.net/docs/assets/558f9e89e4b01a224b42f278/images/66630b35e1989867dcefdb27/file-5gP87CYsRs.gif)
![]() |
More information about the WordPress Table of Contents Plugin Other WordPress products can be found at CreativeMinds WordPress Store |
![]() |
Let us know how we can Improve this Product Documentation Page To open a Support Ticket visit our support center |