Title: Dynamic sub-nav
Last modified: August 19, 2016

---

# Dynamic sub-nav

 *  [nateeanes](https://wordpress.org/support/users/nateeanes/)
 * (@nateeanes)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/dynamic-sub-nav/)
 * Hi All,
    I am building a site using WordPress as a CMS (it only has pages, no
   posts). I’ve got a few questions:
 * 1) I’m going to have a left-hand column that will be populated with sub-nav links
   which will change depending what area of the site you’re looking at. I know one
   way to do this would be to make several different page templates and hard-code
   the appropriate sub-nav items into the left column of each one; however, is there
   a way to do this dynamically, such that if I add a page to a section or change
   a page’s title, the sub-nav will automatically update to reflect this? Is there
   a specific plug-in that might do this?
 * 2) How do I change the URL strings for pages, so that instead of, for instance,
   having “page_id=2” or something like that, I can use customized page name rather
   than an ID number?
 * 3) What is the code to call a specific page to a particular place on your site’s
   Index template page? On my site’s homepage (Index template), I want to have 2-
   3 sections that can be updated automatically, but how do I get the template to
   call those pages to the right spots?
 * Thanks!
    Nate

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [syncbox](https://wordpress.org/support/users/syncbox/)
 * (@syncbox)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/dynamic-sub-nav/#post-918285)
 * Most of what you are wanting is explained in the documentation for WordPress —
   pretty permalinks and child pages, for example.
 * Re: changing the sidebar based on where you are in your site is controlled with
   if/else/elseif type php code — though there are plugins that purport to do this.
   Depending upon if you are using categories or pages for your content, you can
   use the wp_list_pages() function (or the category version), passing parameters
   in the function to control what pages are listed (or categories) and how.
 * Using something like
 *     ```
       <?php if (is_front_page()) {
       wp_list_pages('title_li=&depth=2&include=3,14,16');
       }
       elseif {
       //whatever you want to do here
       }
       else {
       //what should happen (maybe nothing) if not any of the above
       } ?>
       ```
   
 * is what I mean. Use the Docs section here and search for wp_list_pages() to see
   what I mean.
 * The third item you listed isn’t clear… you don’t “call a page” into the index.
   php template. You can query for specific posts based on category or all categories…
   but typically, if you are using WordPress “Pages” you use the page.php file.
 * Based on what you want to do, you can create customized category templates and
   page templates. Again, this is in the Documentation for WordPress, which you 
   can get to by clicking the Docs link at the top of this page.
 * Getting content into specific locations as viewed from a browser requires xhtml
   and css knowledge or using someone else’s theme.
 * HTH
    Casey
 *  Thread Starter [nateeanes](https://wordpress.org/support/users/nateeanes/)
 * (@nateeanes)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/dynamic-sub-nav/#post-918421)
 * Thanks Casey! I think the wp_list_pages() is exactly what I need, and I probably
   need to pair it up with the “child_of” function so it lists the page’s children.
 * As for my third question which wasn’t clear, I guess I’m messed up by having 
   edited a theme made by someone who chose to use pages (not posts) on their homepage.
   They used some kind of `include` statement to do it, which I can’t reproduce 
   successfully on my WP site.
 * Thanks,
    Nate

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Dynamic sub-nav’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [nateeanes](https://wordpress.org/support/users/nateeanes/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/dynamic-sub-nav/#post-918421)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
