Skip to content

Instantly share code, notes, and snippets.

@wprs
Last active June 26, 2016 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wprs/1f8f9b0d60b33b9ff073a423f04a07da to your computer and use it in GitHub Desktop.
Save wprs/1f8f9b0d60b33b9ff073a423f04a07da to your computer and use it in GitHub Desktop.
Use shortcode to display Table Of Content Plus on WPRichSnippets enabled posts https://wprichsnippets.com/doc/table-content-plus/
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
add_filter('wprs_box', 'wprs_add_toc_4321');
/*
Use shortcode to display Table Of Content
This is a simple fix for Table Of Content Plus Plugin
*/
function wprs_add_toc_4321($box) {
if ( shortcode_exists( 'toc' ) ) {
$toc = do_shortcode('[toc wrapping="left"]');
$box = $box .$toc;
}
return $box;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment