{"id":2391,"date":"2015-10-18T16:33:08","date_gmt":"2015-10-18T14:33:08","guid":{"rendered":"http:\/\/www.flagsoft.com\/cmswp\/?page_id=2391"},"modified":"2019-07-31T20:41:50","modified_gmt":"2019-07-31T18:41:50","slug":"update-request-for-toc-wordpress-plugin","status":"publish","type":"page","link":"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/","title":{"rendered":"WordPress Plugin TOC+ with sub menus (Table Of Contents Plus)"},"content":{"rendered":"<h2>WordPress Plugin: Add Sub-Menu Support for TOC+ (Table Of Contents Plus)<\/h2>\n<p>Are you coming from the TOC+ plugin Authors homepage ( http:\/\/dublue.com\/plugins\/toc\/ ) and want to know how I did this?<\/p>\n<p>This is a update request for TOC+ WordPress Plugin article.<\/p>\n<p>&nbsp;<\/p>\n<p>This is an update request for the<\/p>\n<p>TOC+ Plugin of WordPress, see https:\/\/wordpress.org\/plugins\/table-of-contents-plus\/ and authors page here http:\/\/dublue.com\/plugins\/toc\/<\/p>\n<p>You now can use:<\/p>\n\r\n<pre>[sitemap_pages child_of=\"current\"]<\/pre>\r\n\n<p>to show current sub-pages only. \"current\" will be replaced by the current pageID within the plugin function itself. See more on that the source code below.<\/p>\n<p>Use:<\/p>\n\r\n<pre>[sitemap_pages child_of=\"1234\"]<\/pre>\r\n\n<p>to show sub-pages of a given pageID.<\/p>\n<p>&nbsp;<\/p>\n<h2>How can I find a Page ID?<\/h2>\n<p>Easiest way to navigate to the page you want, then hoover over \"Edit Page\", then look at the URL you will find something like:<\/p>\n<p>?post=1234?<\/p>\n<p>(Yes, pages are \"posts\" internally...)<\/p>\n<p>&nbsp;<\/p>\n<p>As you can see, I used it also in my footer a lot.<\/p>\n<p>&nbsp;<\/p>\n<h2>Support<\/h2>\n<p>PS: Like it? You can <a href=\"http:\/\/www.flagsoft.com\/cmswp\/en\/donate\/\" target=\"_blank\" rel=\"noopener noreferrer\">support<\/a> me.<\/p>\n<p>&nbsp;<\/p>\n<h2>Source Code<\/h2>\n<p>File: toc.php updates<\/p>\n<p>[php]<br \/>\nfunction shortcode_sitemap_pages( $atts )<br \/>\n{<br \/>\nglobal $post;<\/p>\n<p>extract( shortcode_atts( array(<br \/>\n'heading' =&gt; $this-&gt;options['sitemap_heading_type'],<br \/>\n'label' =&gt; htmlentities( $this-&gt;options['sitemap_pages'], ENT_COMPAT, 'UTF-8' ),<br \/>\n'no_label' =&gt; false,<br \/>\n'exclude' =&gt; '',<br \/>\n'exclude_tree' =&gt; '',<br \/>\n'child_of' =&gt; $this-&gt;options['child_of']<br \/>\n), $atts )<br \/>\n);<\/p>\n<p>$html='';<br \/>\n\/\/$html.='&lt;!-- child_of:\u00a0\u00a0 ' . $child_of . ' --&gt;' . \"\\n\";\u00a0\u00a0\u00a0 \/\/ true<\/p>\n<p>\/\/ -- [ sitemap_pages child_of=\"current\" ]<br \/>\nif ( $child_of == \"current\" ) {<br \/>\n$child_of = $post-&gt;ID;<br \/>\n} else if ( is_numeric($child_of) ) {<br \/>\n\/\/ -- specific number<br \/>\n} else {<br \/>\n$child_of = 0;<br \/>\n}<\/p>\n<p>$html.='&lt;!-- child_of:\u00a0\u00a0 ' . $child_of . ' --&gt;' . \"\\n\";\u00a0\u00a0\u00a0 \/\/ true<br \/>\n$html.='&lt;!-- current ID: ' . $post-&gt;ID . ' --&gt;' . \"\\n\";\u00a0 \/\/ 2311<br \/>\n$html.=\"\\n\";<\/p>\n<p>\/*<br \/>\n$children = wp_list_pages('title_li=&amp;child_of='.$post-&gt;ID.'&amp;echo=0');<br \/>\nif ($children) {<br \/>\n$html.='<\/p>\n<p>&lt;ul&gt;' . $children . '&lt;\/ul&gt;<\/p>\n<p>';<br \/>\n}<br \/>\n*\/<\/p>\n<p>if ( $heading &lt; 1 || $heading &gt; 6 )\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\/\/ h1 to h6 are valid<br \/>\n$heading = $this-&gt;options['sitemap_heading_type'];<\/p>\n<p>$html .= '<\/p>\n<p>&lt;div class=\"toc_sitemap\"&gt;';<\/p>\n<p>if ( !$no_label ) {<br \/>\n\/\/ label was set<br \/>\n$html .= '&lt;h' . $heading . ' class=\"toc_sitemap_pages\"&gt;' . $label . '&lt;\/h' . $heading . '&gt;';<br \/>\n}<\/p>\n<p>$html .=<br \/>\n'<\/p>\n<p>&lt;ul class=\"toc_sitemap_pages_list\"&gt;' .<br \/>\nwp_list_pages( array('title_li' =&gt; '', 'echo' =&gt; false, 'exclude' =&gt; $exclude, 'exclude_tree' =&gt; $exclude_tree, 'child_of' =&gt; $child_of ) ) .<br \/>\n'&lt;\/ul&gt;<\/p>\n<p>' .<br \/>\n'&lt;\/div&gt;<\/p>\n<p>'<br \/>\n;<\/p>\n<p>return $html;<br \/>\n}<\/p>\n<p>[\/php]<\/p>\n<p>Happy hacking \ud83d\ude09<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress Plugin: Add Sub-Menu Support for TOC+ (Table Of Contents Plus) Are you coming from the TOC+ plugin Authors homepage ( http:\/\/dublue.com\/plugins\/toc\/ ) and want to know how I did this? This is a update request for TOC+ WordPress Plugin article. &nbsp; This is an update request for the TOC+ Plugin of WordPress, see https:\/\/wordpress.org\/plugins\/table-of-contents-plus\/ &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/\"> <span class=\"screen-reader-text\">WordPress Plugin TOC+ with sub menus (Table Of Contents Plus)<\/span> Weiterlesen &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1019,"menu_order":19,"comment_status":"open","ping_status":"open","template":"","meta":{"_uag_custom_page_level_css":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-2391","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>WordPress Plugin TOC+ with sub menus (Table Of Contents Plus) - Flagsoft<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress Plugin TOC+ with sub menus (Table Of Contents Plus) - Flagsoft\" \/>\n<meta property=\"og:description\" content=\"WordPress Plugin: Add Sub-Menu Support for TOC+ (Table Of Contents Plus) Are you coming from the TOC+ plugin Authors homepage ( http:\/\/dublue.com\/plugins\/toc\/ ) and want to know how I did this? This is a update request for TOC+ WordPress Plugin article. &nbsp; This is an update request for the TOC+ Plugin of WordPress, see https:\/\/wordpress.org\/plugins\/table-of-contents-plus\/ &hellip; WordPress Plugin TOC+ with sub menus (Table Of Contents Plus) Weiterlesen &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/\" \/>\n<meta property=\"og:site_name\" content=\"Flagsoft\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-31T18:41:50+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/\",\"url\":\"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/\",\"name\":\"WordPress Plugin TOC+ with sub menus (Table Of Contents Plus) - Flagsoft\",\"isPartOf\":{\"@id\":\"https:\/\/www.flagsoft.com\/cmswp\/#website\"},\"datePublished\":\"2015-10-18T14:33:08+00:00\",\"dateModified\":\"2019-07-31T18:41:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/#breadcrumb\"},\"inLanguage\":\"de-CH\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.flagsoft.com\/cmswp\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Software\",\"item\":\"https:\/\/www.flagsoft.com\/cmswp\/software\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"WordPress Plugin TOC+ with sub menus (Table Of Contents Plus)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.flagsoft.com\/cmswp\/#website\",\"url\":\"https:\/\/www.flagsoft.com\/cmswp\/\",\"name\":\"Flagsoft\",\"description\":\"ALPHA Schulmagazin, Byztxt, Strongsdict, Remote Control Cursor for Mac, PictureViewer4Mac, sdspeed free SD Card Reader for Mac OS X, Byztxt Light, 1A Shopping List, Kindle Book Template\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.flagsoft.com\/cmswp\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de-CH\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress Plugin TOC+ with sub menus (Table Of Contents Plus) - Flagsoft","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/","og_locale":"de_DE","og_type":"article","og_title":"WordPress Plugin TOC+ with sub menus (Table Of Contents Plus) - Flagsoft","og_description":"WordPress Plugin: Add Sub-Menu Support for TOC+ (Table Of Contents Plus) Are you coming from the TOC+ plugin Authors homepage ( http:\/\/dublue.com\/plugins\/toc\/ ) and want to know how I did this? This is a update request for TOC+ WordPress Plugin article. &nbsp; This is an update request for the TOC+ Plugin of WordPress, see https:\/\/wordpress.org\/plugins\/table-of-contents-plus\/ &hellip; WordPress Plugin TOC+ with sub menus (Table Of Contents Plus) Weiterlesen &raquo;","og_url":"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/","og_site_name":"Flagsoft","article_modified_time":"2019-07-31T18:41:50+00:00","twitter_card":"summary_large_image","twitter_misc":{"Gesch\u00e4tzte Lesezeit":"2 Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/","url":"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/","name":"WordPress Plugin TOC+ with sub menus (Table Of Contents Plus) - Flagsoft","isPartOf":{"@id":"https:\/\/www.flagsoft.com\/cmswp\/#website"},"datePublished":"2015-10-18T14:33:08+00:00","dateModified":"2019-07-31T18:41:50+00:00","breadcrumb":{"@id":"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/#breadcrumb"},"inLanguage":"de-CH","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.flagsoft.com\/cmswp\/software\/update-request-for-toc-wordpress-plugin\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.flagsoft.com\/cmswp\/"},{"@type":"ListItem","position":2,"name":"Software","item":"https:\/\/www.flagsoft.com\/cmswp\/software\/"},{"@type":"ListItem","position":3,"name":"WordPress Plugin TOC+ with sub menus (Table Of Contents Plus)"}]},{"@type":"WebSite","@id":"https:\/\/www.flagsoft.com\/cmswp\/#website","url":"https:\/\/www.flagsoft.com\/cmswp\/","name":"Flagsoft","description":"ALPHA Schulmagazin, Byztxt, Strongsdict, Remote Control Cursor for Mac, PictureViewer4Mac, sdspeed free SD Card Reader for Mac OS X, Byztxt Light, 1A Shopping List, Kindle Book Template","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.flagsoft.com\/cmswp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de-CH"}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"yarpp-thumbnail":false,"slide-thumbnail":false},"uagb_author_info":{"display_name":"M","author_link":"https:\/\/www.flagsoft.com\/cmswp\/author\/admin\/"},"uagb_comment_info":7,"uagb_excerpt":"WordPress Plugin: Add Sub-Menu Support for TOC+ (Table Of Contents Plus) Are you coming from the TOC+ plugin Authors homepage ( http:\/\/dublue.com\/plugins\/toc\/ ) and want to know how I did this? This is a update request for TOC+ WordPress Plugin article. &nbsp; This is an update request for the TOC+ Plugin of WordPress, see https:\/\/wordpress.org\/plugins\/table-of-contents-plus\/&hellip;","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/pages\/2391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/comments?post=2391"}],"version-history":[{"count":5,"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/pages\/2391\/revisions"}],"predecessor-version":[{"id":5773,"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/pages\/2391\/revisions\/5773"}],"up":[{"embeddable":true,"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/pages\/1019"}],"wp:attachment":[{"href":"https:\/\/www.flagsoft.com\/cmswp\/wp-json\/wp\/v2\/media?parent=2391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}