hHi all! I have posted this question on the WP support forums, but the community doesn’t seem to be as active as stack’s, so I am taking a chance here!
I am looking for a plugin that would automatically create a navigation menu (through the use of shortcodes for example) on a long single page documentation page.
The long page is divided into sections. I can imagine using a shortcode at the beginning of every section, and this will create a menu that would be displayed in a sidebar for example (called through a second shortcode perhaps, or a widget)
Any thoughts? Advice?
Thanks!
Use
[section]Section Title[/section]shortcodes, then[section_navigation]where you want the navigation links output.This works, but with a massive caveat — that
[section_navigation]needs to be in your post/page after the other[section]shortcodes… otherwise it generates an empty list.You should be ok to use it in your theme by putting
<?php echo do_shortcode("[section_navigation]");?>in sidebar.php. It will work as long asget_sidebar()is afterthe_content()in your theme templates (it usually is).This to go in functions.php