• I know there is no option to exclude heading by “class”. Is there any code snippet I can use in functions php to achieve that?

    Exclude by text is not useful in my case, it would be great to have a feature to exclude by “class”.

    e.g.
    <h2>Heading in TOC</h2>
    <h2 class=”notoc”>Should not be in TOC</h2>

    Thank you.
    SJ

Viewing 3 replies - 1 through 3 (of 3 total)
  • This is exactly what I would need too.

    Thread Starter Shahriyar M Jahangir

    (@shahriyarmj)

    Unfortunately, I haven’t had any response from the author. I edited toc.php in this area to add the condition,

    for ($i = 0; $i < count($matches); $i++) {
    if ( in_array($matches[$i][2], $this->options[‘heading_levels’]) && !strstr($matches[$i][3], ‘notoc’) )
    $new_matches[] = $matches[$i];
    }

    However, any time the plugin updates, I will have to redo the edit :/

    Sincerely,
    //SJ

    That is a good tip.

    Redoing edits is a way of life. I have a notepad file with custom code, parts of which I have to reapply every time a plugin or my theme is updated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exclude by Class programatically?’ is closed to new replies.