• Resolved Brent Wilson

    (@bwbama)


    I use Bootstrap 5 and I am looking at how I can alter the classes that are added to the TOC section. Is this something I can do with hooks?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Steven

    (@shazahm1hotmailcom)

    There is only a single filter for class names. It is ez_toc_container_class. Hookin into this filter allows you to add/remove classes to the TOC container.

    Thread Starter Brent Wilson

    (@bwbama)

    Thank you, what would the code look like to add a custom class with this filter and remove all classes that the plugin adds?

    • This reply was modified 3 years, 6 months ago by Brent Wilson.
    Thread Starter Brent Wilson

    (@bwbama)

    Not for lack of effort but have not been able to figure out the use case for this. Is there documentation somewhere? It is only referenced three times in the code base and can’t seem to wrap my head around it.

    Thread Starter Brent Wilson

    (@bwbama)

    This is what I am trying to accomplish: https://stackoverflow.com/a/33571268/11552576

    Steven

    (@shazahm1hotmailcom)

    There are not enough filters to change all the classes shown in SO. Only the top-level container CSS has a filter, ez_toc_container_class. Here’s an example of how to use it.

    add_filter(
        'ez_toc_container_class',
        function( $custom_classes ) {
            return $custom_classes . ' list-group list-group-root well';
        }
    );

    If you are writing your own CSS and JS, you could use all the CSS classes already output by ezTOC.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Options for styling, changing classes’ is closed to new replies.