PMC Plugins
Pmc Toc

PMC TOC

Loosely based on a TOC plugin by Automattic:

http://meta.svn.wordpress.org/sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php (opens in a new tab)

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 TOC Post Option. By default, any h2 tag will be included in the TOC.

Additional configurations

  • If you would like to use another header tag instead of the h2 for your TOC. You can use the pmc_toc_tag filter. 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_active filter. By default, this filter is true if the pmc-larva plugin is active within the theme; if not it's false. To override this, a theme can use __return_true or __return_false. A false setting will enqueue the utilities within this plugin.

######Example

add_filter( 'pmc_toc_larva_active', '__return_true' );