Title: Code troubleshooting help
Last modified: August 19, 2016

---

# Code troubleshooting help

 *  Resolved [bmanderson](https://wordpress.org/support/users/bmanderson/)
 * (@bmanderson)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/)
 * I just recently upgraded my wordpress to 2.5.1 … and I think I have everything
   working except for the navigation in the header. Previously I had all of my pages
   there (home, about, Mongolia, prayer, photos – those were the page names) – now
   only home and photos show up. I am an admitted code novice – but I want to learn.
   Could someone help me troubleshoot the following code?
 * My site is [http://www.remembermongolia.org](http://www.remembermongolia.org)
 * Thanks in advance!
 * <!– navigation …………………………… –>
    <div id=”navigation”>
 *  <form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”get”>
    <fieldset>
   <input value=”<?php echo wp_specialchars($s, 1); ?>” name=”s” id=”s” /> <input
   type=”submit” value=”Go!” id=”searchbutton” name=”searchbutton” /> </fieldset
   > </form>
    - 
       <?php $pages = BX_get_pages(); if ($pages) { foreach ($pages as $page) {
      $page_id = $page->ID; $page_title = $page->post_title; $page_name = $page-
      >post_name; if ($page_name == “archives”) { (is_page($page_id) || is_archive()
      || is_search() || is_single())?$selected = ‘ class=”selected”‘:$selected=”;
      echo “<li”.$selected.”>Archives\n”; } elseif($page_name == “about”) { (is_page(
      $page_id))?$selected = ‘ class=”selected”‘:$selected=”; echo “<li”.$selected.”
      >About\n”; } elseif ($page_name == “contact”) { (is_page($page_id))?$selected
      = ‘ class=”selected”‘:$selected=”; echo “<li”.$selected.”>Contact\n”; } elseif(
      $page_name == “about_short”) {/*ignore*/} else { (is_page($page_id))?$selected
      = ‘ class=”selected”‘:$selected=”; echo “<li”.$selected.”>$page_title\n”; }}}?
      >
    - [Photos](http://www.remembermongolia.org/wp-content/plugins/falbum/wp/album.php)
 * </div><!– /navigation –>

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

 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791258)
 * this isnt related specifically to your problem, however in the course of fixing
   that you should fix this:
 * `<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">`
 * it ought to be:
 * `<form method="get" action="<?php bloginfo('url'); ?>/">`
 * relying on `$_SERVER['PHP_SELF']` opens you up to cross-site scripting attacks.
 *  Thread Starter [bmanderson](https://wordpress.org/support/users/bmanderson/)
 * (@bmanderson)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791484)
 * Thanks Whoo, fixed that.
 * Now .. for the other issue. I know there’s something that’s been screwed up with
   this code at some point during the upgrade process. I am just not familiar enough
   with it to know what it is. Some help please?
 *  [iridiax](https://wordpress.org/support/users/iridiax/)
 * (@iridiax)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791487)
 * **post_name** in your code is the slug for pretty permalinks, and you are using
   default (non-pretty) permalinks. Did you used to use pretty permalinks when the
   code worked?
 *  Thread Starter [bmanderson](https://wordpress.org/support/users/bmanderson/)
 * (@bmanderson)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791497)
 * I used whatever came with the theme.
 * It changed when I restored my database after an upgrade.
 * So I honestly don’t know why it’s not working. I didn’t change anything.
 * I will play around with the permalink settings. I don’t remember what they were
   before…
 * The more I learn about this, the more I realize I don’t know… :s
 *  Thread Starter [bmanderson](https://wordpress.org/support/users/bmanderson/)
 * (@bmanderson)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791500)
 * okay I did change the permalinks to “prettier” (month/day/post). But to no avail…
 * I am wondering about the \n that’s stuck in there? That doesn’t look right to
   me.
 *  [xtra](https://wordpress.org/support/users/babypress/)
 * (@babypress)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791501)
 * A bit of track but I checked out your site and wondered how you have the archives
   as a drop down selection menu? I like it.
 *  Thread Starter [bmanderson](https://wordpress.org/support/users/bmanderson/)
 * (@bmanderson)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791502)
 * I used this bit of code for that. It’s been nice to have. Cleaned up the side
   bar a bit. I found it someplace online …
 * <h2>_<?php \_e(‘Archives’); ?>_</h2>
    <form id=”archiveform” action=””> <p><select
   name=”archive_chrono” onchange=”window.location=(document.forms.archiveform.archive_chrono[
   document.forms.archiveform.archive_chrono.selectedIndex].value);”> <option value
   =”>Select month</option> <?php wp_get_archives(‘type=monthly&format=option’);?
   > </select></p> </form>
 *  [xtra](https://wordpress.org/support/users/babypress/)
 * (@babypress)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791572)
 * Thanks bmanderson, very handy little bit of code!
 *  Thread Starter [bmanderson](https://wordpress.org/support/users/bmanderson/)
 * (@bmanderson)
 * [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791573)
 * No problem, babypress.
 * For what it’s worth – I did resolve my issue. Found another way to code the header
   navigation menu that is much less convoluted…
 * So … issue resolved … I think.
 * 🙂

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

The topic ‘Code troubleshooting help’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 4 participants
 * Last reply from: [bmanderson](https://wordpress.org/support/users/bmanderson/)
 * Last activity: [17 years, 12 months ago](https://wordpress.org/support/topic/code-troubleshooting-help/#post-791573)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
