PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.2.6
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.2.6
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / views / templates / parts / toc.php

toc.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.2.6, at views/templates/parts/toc.php

29 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! betterdocs()->settings->get( 'enable_toc', false ) ) {
3 return;
4 }
5
6 // Check if post is password protected and user hasn't provided correct password
7 // This applies to all contexts: templates, Gutenberg blocks, and Elementor widgets
8 if ( post_password_required() ) {
9 // Don't show ToC for password-protected posts until password is provided
10 return;
11 }
12
13 $toc_hierarchy = betterdocs()->settings->get( 'toc_hierarchy' );
14 $toc_list_number = betterdocs()->settings->get( 'toc_list_number' );
15 $collapsible_toc_mobile = betterdocs()->settings->get( 'collapsible_toc_mobile' );
16 $supported_tag = betterdocs()->settings->get( 'supported_heading_tag', '' );
17 $htags = $supported_tag ? implode( ',', $supported_tag ) : '';
18
19 $attributes = betterdocs()->template_helper->get_html_attributes(
20 [
21 'htags' => "{$htags}",
22 'hierarchy' => "{$toc_hierarchy}",
23 'list_number' => "{$toc_list_number}",
24 'collapsible_on_mobile' => "{$collapsible_toc_mobile}"
25 ]
26 );
27
28 echo do_shortcode( '[betterdocs_toc ' . $attributes . ']' );
29