• Would it be possible to filter the list item text? I have a client that would like to be able to replace list item text with custom text. I can handle the customizations needed to make this happen. I just need a filter on each list item string to make it work. So possibly add a filter in the “extract_headings” function? The Easy Table of Contents plugin refers to this as “alttext” and adds a meta box on the post editor. That plugin does several things I don’t care for and tends to increase Google’s CLS score by a lot so I’d rather not use it but the filter/replace feature is something I need. Just a simple apply_filters on the text would be great! Thanks for an awesome plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter aapc

    (@aapc)

    I’d like to suggest the following changes:

    original line: 1232
    $html .= strip_tags($matches[$i][0]) . '</a>';

    new line: 1232
    $html .= apply_filters('toc_item_text', strip_tags($matches[$i][0])) . '</a>';

    original line: 1397
    $items .= strip_tags($matches[$i][0]) . '</a></li>';

    new line: 1397
    $items .= apply_filters('toc_item_text', strip_tags($matches[$i][0])) . '</a></li>';

    These two simple changes would accomplish exactly what I need. I can modify the plugin but I hate to do so and risk losing my modifications if it’s every updated from the repository. Your assistance would be greatly appreciated!

    Thread Starter aapc

    (@aapc)

    Unfortunately the 2106 release did not include any additional filters. I guess I’ll have to modify the plugin to add this simple change. Maybe next time.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter List Items?’ is closed to new replies.