开发者 | Ulrich Kautz |
---|---|
更新时间 | 2011年3月7日 03:55 |
PHP版本: | 2.7 及以上 |
WordPress版本: | 3.1.0 |
[table-of-content]
before the text and [/table-of-content]
after the text. All Text in between will be used to generate the TOC.[table-of-content title="This is the TOC"]
Yes, via stylesheet, like so: .pni-content .toplink { display: none ! important }
Yes, also via stylesheet. For using decimals in all instances (level1, level2, ..): .pni-navigation ol li { list-style-type: decimal ! important } Or to use discs (non-numeric), change the style like so: .pni-navigation ol li { list-style-type: disc ! important } See http://www.w3schools.com/css/pr_list-style-type.asp for more info
Yes. The following example shows how you can add the TOC as a filter to the_content, which will auto-use the TOC in any of your posts. Therefore add the following at the end of the functions.php
file of your theme:
if ( function_exists( 'toc_filter' ) && ! function_exists( 'theme_toc_filter' ) ) {
function theme_toc_filter( $content = "" ) {
return toc_filter( $content );
}
add_filter( 'the_content', 'theme_toc_filter' );
}
If you use other content modifying plugins and your short-codes get messed up, try to adjust the priority higher (eg: add_filter( 'the_content', 'theme_toc_filter', 999 )
or even higher).
If you need to disable the TOC in a single page of your theme, you can define the 'DISABLE_TOC' constant with a true value:
define( 'DISABLE_TOC', true );