LuckyWP Table of Contents

Description

Creates a table of contents for your posts, pages or custom post types. Great customizable appearance.

Features

  • Automatical insertion a table of contents (configure post types and position).
  • Insert by shortcode or Gutenberg block.
  • Button on toolbar of the classic editor.
  • Gutenberg block into “Common Blocks”.
  • Setting the minimum number of headings to display table of contents.
  • Setting the depth of headings for table of contents.
  • Hierarchical or linear view.
  • Numeration items: decimal or roman numbers in order or nested.
  • Customizable appearance: width, float, title font size and weight, items font size, colors.
  • Color schemes (dark, light, white, transparent) and the ability to override colors.
  • Toggle Show/Hide (optionally)
  • Customizalbe labels.
  • Smooth scroll (optionally).
  • Setting offset top for smooth scroll.
  • Wrap table of contents with <!–noindex–> tag (optionally).
  • Available override global settings for a particular post.
  • Highly compatible with WordPress themes and plugins.

Auto Insert

For automatical insertion a table of contents in a posts, select option “Auto Insert Table of Contents” in the plugin settings (tab “Auto Insert”).

Supported positions:

  • before first heading;
  • after first heading;
  • after first block (paragraph, list or heading);
  • top of post content;
  • bottom of post content.

You can also select post types to which the table of contents will be automatically added.

Hooks

Filters lwptoc_before, lwptoc_after

Use for add custom HTML before/after the table of contents.

Example:

add_filter('lwptoc_before', function ($before) {
    return '<p>Example text before TOC.</p>' . $before;
});

Filter lwptoc_shortcode_tag

Use this filter for change shortcode tag name [lwptoc].

Example:

add_filter('lwptoc_shortcode_tag', function ($tag) {
    return 'toc';
});

Screenshots

  • Table of Contents
  • Gutenberg Support
  • Classic Editor Support
  • Customize Window
  • Examples of Color Solutions
  • General Settings
  • Appearance Settings
  • Auto Insert Settings
  • Miscellaneous Settings

Installation

Installing from the WordPress control panel

  1. Go to the page “Plugins > Add New”.
  2. Input the name “LuckyWP Table of Contents” in the search field
  3. Find the “LuckyWP Table of Contents” plugin in the search result and click on the “Install Now” button, the installation process of plugin will begin.
  4. Click “Activate” when the installation is complete.

Installing with the archive

  1. Go to the page “Plugins > Add New” on the WordPress control panel
  2. Click on the “Upload Plugin” button, the form to upload the archive will be opened.
  3. Select the archive with the plugin and click “Install Now”.
  4. Click on the “Activate Plugin” button when the installation is complete.

Manual installation

  1. Upload the folder luckywp-table-of-contents to a directory with the plugin, usually it is /wp-content/plugins/.
  2. Go to the page “Plugins > Add New” on the WordPress control panel
  3. Find “LuckyWP Table of Contents” in the plugins list and click “Activate”.

After activation

Into classic editor will appear button “Table of Contents” (available on edit post/page screen).
Into Gutenberg editor will appear block “Table of Contents” (see “Common Blocks”).
The menu item “Table of Contents” will appear in the menu “Settings” of the WordPress control panel.

Reviews

Would be great if hashtags were “pretty”

At first I was excited about this plugin because it can capture headings outside of the body content (unlike Easy Table of Contents). But then I discovered that the hashtags are generated like "#lwptoc1" instead of "#Heading_text". When sharing a link to a FAQ or a chapter it would look so much better to have it say www.your-site/#how_do_I_do_this. Please consider changing this.

Perfect

Pleasure to work with. Does all you can think of in terms of TOC. Thanks for the plugin.
Read all 9 reviews

Contributors & Developers

“LuckyWP Table of Contents” is open source software. The following people have contributed to this plugin.

Contributors

“LuckyWP Table of Contents” has been translated into 3 locales. Thank you to the translators for their contributions.

Translate “LuckyWP Table of Contents” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.1.1

  • Tag <noindex> replaced to <!–noindex–>.

1.1.0

  • Added option “Wrap table of contents with <noindex> tag”.
  • Added hook filters lwptoc_before, lwptoc_after, lwptoc_shortcode_tag.
  • Fix: into Gutenberg editor in block “Classic editor” don’t loaded CSS for shortcode.

1.0.4

  • Bug fix

1.0.3

  • Minor appearance changes
  • Bug fix

1.0.2

  • Bug fix

1.0.1

  • Bug fix