Support » Plugin: Easy Table of Contents » Alternate Headings Bug

  • I noticed that “Alternate Headings” does not work in the current version of the plugin.

    In easy-table-of-contents.php file you replace the title and save new in $toc variable.

    if ( @preg_match( ‘/^’ . $original_heading . ‘$/imU’, strip_tags( $toc[ $i ][0] ) ) ) {
    //$matches[ $i ][0] = str_replace( $original_heading, $alt_heading, $matches[ $i ][0] );
    $toc[ $i ][0] = $alt_heading;

    Then you use $matches variable to print the $title

    Maybe it depends on the version of PHP and in some versions when changing the $toc – changes $matches, but I think that this is the wrong approach.


    And thanks for the plugin, very useful, except this little bug.

    • This topic was modified 2 years, 11 months ago by sdelfi.
Viewing 1 replies (of 1 total)
  • Thread Starter sdelfi


    But my hack did not work, because incorrectly formed anchor (I have it custom, modified through hook – ez_toc_url_anchor_target)

    I was helped by the following change

    $title = strip_tags( apply_filters( ‘ez_toc_title’, $matches[ $i ][0] ), apply_filters( ‘ez_toc_title_allowable_tags’, ” ) );


    $title = strip_tags( apply_filters( ‘ez_toc_title’, $toc[ $i ][0] ), apply_filters( ‘ez_toc_title_allowable_tags’, ” ) );

    After change

Viewing 1 replies (of 1 total)
  • The topic ‘Alternate Headings Bug’ is closed to new replies.