| 开发者 | jamesckemp |
|---|---|
| 更新时间 | 2018年8月1日 03:01 |
| 捐献地址: | 去捐款 |
| PHP版本: | 4.0 及以上 |
| WordPress版本: | 4.9.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[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./wp-content/plugins/shortcode-toc directory, or install the plugin through the WordPress plugins screen directly.No. Currently it'll only work once per page.
Did you set the content parameter of the shortcode to a valid CSS selector on your page? This is a required argument.
Yup, your shortcode would look like this [toc content=".your-container" headers="h2,h3"]
You can use the do_shortcode() function like this:
<?php echo do_shortcode( '[toc content=".your-container"]' ); ?>