| 开发者 | jalandhar04 |
|---|---|
| 更新时间 | 2026年9月25日 18:30 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
<nav> landmark - so it is just as valuable to search engine crawlers and screen readers as it is to human visitors. Long-form guides, tutorials, recipes, FAQs, and review posts all rank and read better with a well-structured table of contents.
Table of Contents Features
<ul>/<li> (or <ol>/<li>) lists inside a <nav> landmark with clean anchor links that search engines may use for jump-to-section links in results.[jptoc] shortcode, the Gutenberg "Table of Contents" block, a widget, or the classic editor toolbar button.example.com/faq/#How_Do_This) instead of random IDs, with options for lowercase conversion and dash separation.aria-expanded states on toggles and descriptive aria-label attributes on <nav> landmarks.[jptoc] shortcode anywhere in your content#How_Do_This), keeping your URLs human-readable. Under the "Misc." settings tab, in the "Hash" section, you can choose the anchor format (as heading, as heading without transliterate, or a counter such as #jptoc1), convert anchors to lowercase, and replace underscores with dashes.
Note: For non-English websites using the "As heading" anchor format, enabling the Intl PHP extension ensures proper transliteration of anchors.
Compatibility
Jalandhar Table of Contents has been tested for compatibility with:
jptoc_before and jptoc_after
Add custom HTML immediately before or after the table of contents.
add_filter('jptoc_before', function ($before) {
return '
Custom text before TOC.' . $before;
});
Filter jptoc_shortcode_tag
Change the shortcode tag from the default [jptoc].
add_filter('jptoc_shortcode_tag', function ($tag) {
return 'toc';
});
Filter jptoc_heading_id
Customize the anchor ID generated for individual headings.
add_filter('jptoc_heading_id', function ($id, $label) {
return $id;
}, 10, 2);
jalandhar-table-of-contents folder to your /wp-content/plugins/ directory.Once active, the plugin can automatically insert a TOC based on your rules. Alternatively, use the [jptoc] shortcode, the Gutenberg block, or the widget.
Check the "Minimal Count of Headings" setting under General - if a post has fewer headings than this value, no table of contents is displayed. Also check the "Auto Insert" tab to confirm the current post type and position settings match where you expect it to appear.
Yes. Go to the "Auto Insert" tab in the plugin settings and choose which post types (posts, pages, or any custom post type) should have a table of contents inserted automatically, along with where on the page it should appear.
If you use the widget independently without auto-insertion or blocks, go to the "Processing Headings" settings tab and add your post types under "Always for Post Types", then save. This guarantees heading IDs are added even without a visible TOC.
Yes. Under the "Misc." tab, in the "Skip Headings" section, you can skip specific heading levels (e.g. H1 or H6) entirely, or exclude headings whose text matches a pattern you define.
Yes. Enable "Hierarchical View" under the General tab to nest lower-level headings (e.g. H3) under their parent headings (e.g. H2) in the generated list.
Yes. The Appearance tab lets you control width, alignment, colors, and font sizes and weights. The "List Markup Tags" option on the "Misc." tab lets you choose between semantic <ul>/<li> markup, <ol>/<li>, or plain <div> elements.
Yes. It has been tested with Elementor, Beaver Builder, WPBakery Page Builder, and Oxygen. See the Compatibility section above for the full list.
Yes. The generated markup uses a <nav> landmark with an aria-label, and the show/hide toggle exposes its expanded/collapsed state via aria-expanded for screen reader users.
Please use the support forum on this plugin's WordPress.org page. Include your WordPress version, PHP version, and steps to reproduce the issue whenever possible.