Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6722521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:27:26+00:00 2026-05-26T09:27:26+00:00

hHi all! I have posted this question on the WP support forums, but the

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:27:26+00:00Added an answer on May 26, 2026 at 9:27 am

    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 as get_sidebar() is after the_content() in your theme templates (it usually is).

    This to go in functions.php

    $whit_sections = "";
    
    // [section]My Section Title[/section]                                          
    function whit_section_shortcode( $atts, $title = null ) {
        // $content is the title you have between your [section] and [/section] 
    
        $id = urlencode(strip_tags($title)); 
        // strip_tags removes any formatting (like <em> etc) from the title.
        // Then urlencode replaces spaces and so on.
    
        global $whit_sections;
        $whit_sections .= '<li><a href="#'.$id.'">'.$title.'</a></li>';
    
        return '<span id="'.$id.'">'.$title.'</span>';
    
    }
    add_shortcode('section', 'whit_section_shortcode');
    
    
    // [section_navigation]
    function whit_section_navigation_shortcode( $atts, $title = null ) {
    
        global $whit_sections;
        return '<ul class="section-navigation">'.$whit_sections.'</ul>';
    
    }
    add_shortcode('section_navigation', 'whit_section_navigation_shortcode');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I have a default sub-command , or handle the case where no
I have the following code and it gives an error hello.l,line 31: premature EOF
I am using a function to trigger when any of a particular set of
I'd like to change the formatting of a date in Symfony 1.4 The default

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.