• 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 1 replies (of 1 total)
  • #1) I’d recommend custom fields. When you are creating or editing a page, they appear in Advanced Options directly below the page content editing form.

    Each custom field takes a ‘key’ and a ‘value’. This is pretty straight-forward. On the template end I use this to give me a set of variables matching the keys, with values assigned:

    <?php foreach (get_post_custom() as $key => $value) { $$key = $value; } ?>

    So if you establish a ‘section’ custom-field key that you set for each page, with values matching the 4 (or whatever) different sections of the site requiring different navigation, all you need to do is check the value of $section on each page and load the relevant nav. Does that makes sense?

    #2) Check the ‘settings’ tab, and the ‘permalinks’ sub tab. Or, more reliably, on the page creation/editing form a permalink line appears (after you have entered a title), and you can change it as you like.

    #3) Good question. I don’t know. I’ve always used posts instead of pages to build a CMS on WP – which makes that much simpler because you just call the loop as many times as you need.

Viewing 1 replies (of 1 total)

The topic ‘Questions about sub-navigation’ is closed to new replies.