Problem Adding Child Items to a Menu Button

Hi,

I am in a position where I need to modify a site that I did not build, and the person that built it cannot be contacted. Here is the site.

Basically, I need create sub-menu items of a button in the navigation that currently does not have any. I need to add a dropdown to “Contact.” I can’t figure out what is different between the buttons with dropdowns and the buttons without, with respect to the PHP. The problem is that the person the created the website opted not to use the built-in menu creation and coded everything with PHP. I don’t understand PHP enough to figure out what is keeping the child items from displaying underneath this button upon hovering over it.

Here is the code for the navigation menu:

[php]

  • Home
  • About Us <?php $childpages = get_pages("child_of=8"); if ($childpages) { ?>
    • Who Are We?
    • <?php wp_list_pages('title_li=&sort_column=menu_order&child_of=8&depth=2'); ?>
    <?php } ?>
  • Blog
      <?php wp_list_categories('title_li=&depth=2'); ?> <?php wp_list_pages('title_li=&sort_column=menu_order&child_of=6&depth=2'); ?>
  • Schools <?php $childpages = get_pages("child_of=13"); if ($childpages) { ?>
      <?php wp_list_pages('title_li=&sort_column=menu_order&child_of=13&depth=2'); ?>
    <?php } ?>
  • Get Involved <?php $childpages = get_pages("child_of=16"); if ($childpages) { ?>
      <?php wp_list_pages('title_li=&sort_column=menu_order&child_of=16&depth=2'); ?>
    <?php } ?>
  • Membership <?php $childpages = get_pages("child_of=17"); if ($childpages) { ?>
      <?php wp_list_pages('title_li=&sort_column=menu_order&child_of=17&depth=2'); ?>
    <?php } ?>
  • Store <?php $childpages = get_pages("child_of=18"); if ($childpages) { ?>
      <?php wp_list_pages('title_li=&sort_column=menu_order&child_of=18&depth=2'); ?>
    <?php } ?>
  • Donate <?php $childpages = get_pages("child_of=19"); if ($childpages) { ?>
      <?php wp_list_pages('title_li=&sort_column=menu_order&child_of=19&depth=2'); ?>
    <?php } ?>
  • Contact <?php $childpages = get_pages("child_of=15"); if ($childpages) { ?>
      <?php wp_list_pages('title_li=&sort_column=menu_order&child_of=20&depth=2'); ?>
    <?php } ?>
[/php]

About Us, Blog, and Schools have sub-menu items, but the rest of the buttons do not. However, from looking at the PHP, I can’t tell what makes those buttons different internally from the ones that cannot display sub-menu items.

I have tried adding items as child pages to these main pages using the dialogue box on the Page Edit screen, but this doesn’t cause any change either. I think maybe this is the reason that some look hard-coded and other don’t?

I assume that I need to somehow modify that “if” statement, but after reading tons of documentation, I am at a complete loss. Does anyone have any advice for me?

Thank you!

Well, not knowing how your entire WordPress site is set up, I am only guessing.
But, in your posted code, you get a “permalink” such as “Schools” and then post a link for it.
Then, you get the “child” pages for that “Schools” link using the INDEX of the permalink, #13.
If there are “child” pages, hence the “IF”, you display the “child” pages.

Therefore, I think first, you should see if you have an CHILD pages in your DB for the “CONTACT”.
If not, add them into the DB to start with. Also, while in the DB, check for the index number for the
“permalink” for the “CONTACT” entries. Then, add the get-child code and the if-child code.

Hope that helps. If not ask further questions. Good luck…

Looking at your code it seems that the site is running Suffusion as the theme. If this is correct then the child pages are easy to set-up. If you are running Suffusion you do not need to get in to the code you can do it with configuration options within the theme. If it is Suffusion I can answer here or it may be better to move the discussion to the Suffusion support forum, either way I will need your url to take a look at the site.

Actually, the site is built on a custom theme, not Suffusion. The URL is http://www.renewanation.org

I do have child pages added to Contact that I have done through the editing page for those pages, but it has no effect on either the code or whether they display or not. Whoever set up the site did not create a menu through the interface at all, but rather used just PHP to do it.

How do you find the permalink for a page? And also, I don’t understand why the code for each page is the same in length. The “About Us” page, for instance, has 11 child pages, but only one permalink is listed. Even the pages that don’t currently have child pages at all seem to have permalinks listed. Something seems very “off” to me about the way this is built.

Sponsor our Newsletter | Privacy Policy | Terms of Service