PMC TOC
Loosely based on a TOC plugin by Automattic:
How it works
- Minimum configuration only requires enabling the plugin in the theme. For any post that you wish to have a TOC, simply check the
Add TOCPost Option. By default, anyh2tag will be included in the TOC.
Additional configurations
- If you would like to use another header tag instead of the
h2for your TOC. You can use thepmc_toc_tagfilter. Note: you MUST use a header tag. At the moment, only ONE tag is supported by this plugin.
######Example
function filter_pmc_toc_tag( $tag ) {
return 'h4';
}
add_filter( 'pmc_toc_tag', 'filter_pmc_toc_tag' );- By default, jump-to-top links are enabled. If you would like to disable jump-to-top links use the
pmc_toc_jump_to_top.
######Example
add_filter( 'pmc_toc_jump_to_top', '__return_false' );- This plugin follows Larva utility patterns, but also has a way to load or remove Larva utilities based on the
pmc_toc_larva_activefilter. By default, this filter is true if thepmc-larvaplugin is active within the theme; if not it's false. To override this, a theme can use__return_trueor__return_false. Afalsesetting will enqueue the utilities within this plugin.
######Example
add_filter( 'pmc_toc_larva_active', '__return_true' );