Making WordPress.org


Ignore:
Timestamp:
12/14/2022 08:50:22 PM (2 years ago)
Author:
ryelle
Message:

Support HelpHub: Sync with Git WordPress/wporg-documentation-2022@10d5cbc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/handbook-toc/table-of-contents.php

    r12288 r12327  
    5454
    5555    public function load_filters() {
    56         if ( is_singular( $this->post_types ) && ! is_embed() && ! is_front_page() ) {
     56        $page_supports_toc = is_singular( $this->post_types ) && ! is_embed() && ! is_front_page();
     57
     58        /**
     59         * Filter whether the table of contents should be injected into the page.
     60         *
     61         * @param bool $page_supports_toc True if the current page supports a table of contents.
     62         */
     63        $should_add_toc = apply_filters( 'wporg_handbook_toc_should_add_toc', $page_supports_toc );
     64
     65        if ( $should_add_toc ) {
    5766            add_filter( 'the_content', array( $this, 'add_toc' ) );
    5867        }
Note: See TracChangeset for help on using the changeset viewer.