Viewing 5 replies - 1 through 5 (of 5 total)
  • Anonymous User 15325940

    (@anonymized-15325940)

    I have a similar problem: If you add post previews using your plugin, the h2 h3 tag is used and is automatically added to the table of contents. How could I achieve that post suggestions are not included in the TOC?

    Plugin Author codesupplyco

    (@codesupplyco)

    /**
     * Toc exclude selectors.
     *
     * @param string $selectors The selectors. Only single level.
     */
    function your_toc_exclude( $selectors ) {
    	$selectors .= '|.tag-selector-1|.tag-selector-2';
    	return $selectors;
    }
    add_filter( 'pk_toc_exclude', 'your_toc_exclude' );
    Anonymous User 15325940

    (@anonymized-15325940)

    Thanks for your reply! I added the snippet. Unfortunately, it has no effect in my case.

    Plugin Author codesupplyco

    (@codesupplyco)

    If you need to exclude posts, then the code will be like this:

    /**
     * Toc exclude selectors.
     *
     * @param string $selectors The selectors. Only single level.
     */
    function toc_exclude( $selectors ) {
    	$selectors .= '|.pk-title|.cnvs-block-posts-title';
    	return $selectors;
    }
    add_filter( 'pk_toc_exclude', 'toc_exclude' );
    Anonymous User 15325940

    (@anonymized-15325940)

    Great – that works!! Many thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to exclude a certain header from the Table of Contents’ is closed to new replies.