跳到内容

Shortcode Table of Contents

v1.0.3

James Kemp · 2017年11月29日 上架

Display an automated table of contents via shortcode.

正在使用
200+
评分
4.7 / 5
累计下载
2.9 万
最近更新
2018年8月1日
6 条评价需要 WordPress 4.0+已测试到 4.9.36

贡献者

截图

Add the [toc] shortcode to any post/page/custom-post-type, at any position in the content.
Add the [toc] shortcode to any post/page/custom-post-type, at any position in the content.
A nested list will be generated based on the headings within your chosen HTML element.
A nested list will be generated based on the headings within your chosen HTML element.
Add the anchor-text parameter.
Add the anchor-text parameter.
When the anchor-text parameter is set, the text will be appended to your headings so your users can easily copy the link to that section.
When the anchor-text parameter is set, the text will be appended to your headings so your users can easily copy the link to that section.

Simply use the [toc content=".your-container"] shortcode to automatically generate a table of contents for any HTML container.

The shortcode accepts a number of parameters:

  • content string required
    A CSS selector indicating the container of your content.
  • headers string
    A comma separated list of heading selectors that you want to include.
  • speed int
    Speed of sliding back to top.
  • anchor-class string
    Class of anchor links.
  • anchor-text string
    Prepended or appended to anchor headings. Leave blank to disable anchor links.
  • top_class string
    Back to top button or link class.
  • spy true/false
    Enable scroll spy. This will highlight the list items as you scroll past them.
  • position append/prepend
    Position of anchor text.
  • spy-offset int
    Specify heading offset for spy scrolling.

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums