ID ) ) { // Don't show ToC for password-protected posts until password is provided return; } // Process content for special characters without triggering heavy content filters // This prevents memory issues from plugins like WPML while still handling special characters $processed_content = $widget->process_content_for_toc( $post->post_content ); $toc_data = $widget->format_toc_data( $processed_content, $htags, $hierarchy ); if ( empty( $toc_data->items ) ) { return; } } else { return; } $collapsible_arrow = ''; $wrapper_classes = [ 'betterdocs-toc' ]; if ( empty( $toc_title ) ) { $toc_title = betterdocs()->settings->get( 'toc_title', __( 'Table of Contents', 'betterdocs' ) ); $toc_title = esc_html( stripslashes( $toc_title ) ); } if ( $collapsible_on_mobile == '1' ) { $wrapper_classes[] = 'collapsible-sm'; $collapsible_arrow = ""; } if ( $list_number == '1' ) { $wrapper_classes[] = 'toc-list-number'; } ?>