Support » Plugins » Navigation menu problems – which file to hack?

  • Hi,

    I just updated my wordpress blog from an ancient version up to 2.1.1 . I am really happy with the result – the backend is sooo much richer with functionality!

    My only small problem, is that I used to have a navigation bar that linked to each of the Pages I had created in my blog (such as http://www.t-shirt-alert.com/buying-t-shirts). The navigation bar ran horizontally in the blue strip underneath the main “T-Shirt-Alert” header image. But now all that is left is the “Home” navigation link, and all the other links have disappeared.

    Now, I could well have deleted or overwritten the original file in which I had hardcoded this change, I am not sure.

    My question is, which file should I be looking at hacking to get my beloved horizontal menu back, so that users can easily access all of the hardcoded pages (such as About Us, Contact Us etc).

    Thanks in advance,
    Jake

Viewing 3 replies - 1 through 3 (of 3 total)
  • It likely will be in header.php of your theme folder.
    However, check your
    admin -> Manage -> Pages
    and see what’s listed. You may just need to rebuild your “Pages” links.

    Thread Starter JakeThePeg

    (@jakethepeg)

    Hey…the problem is definitely in the header.php file in my theme folder, but I am no php expert so can’t understand why this code isn’t working.

    The way that I confirmed it was the header.php file, was that I changed the text “Home” to “Homey” as a test, and of course when I refreshed the blog the text changed accordingly.

    I have attached the navigation code…does anyone have any ideas why my blog is not picking up the static Pages I have created in WordPress and adding them to my navigation bar? I have also tried creating new Pages but to no avail..

    Here’s the code.

    <!-- 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> -->
    
    	<ul>
    		<li<?php if (is_home()) echo " class='selected'"; ?>><a href="<?php bloginfo('home'); ?>">Home</a></li>
    		<?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."><a href=\"".get_page_link($page_id)."\">Archives</a></li>\n";
       				}
       				elseif($page_name == "about") {
       					(is_page($page_id))?$selected = ' class="selected"':$selected='';
       					echo "<li".$selected."><a href=\"".get_page_link($page_id)."\">About</a></li>\n";
       				}
       				elseif ($page_name == "contact") {
       					(is_page($page_id))?$selected = ' class="selected"':$selected='';
       					echo "<li".$selected."><a href=\"".get_page_link($page_id)."\">Contact</a></li>\n";
       				}
       				elseif ($page_name == "about_short") {/*ignore*/}
               	 	else {
                		(is_page($page_id))?$selected = ' class="selected"':$selected='';
                		echo "<li".$selected."><a href=\"".get_page_link($page_id)."\">$page_title</a></li>\n";
                	}
        		}
        	}
    		?>
    	</ul>
    
    </div><!-- /navigation -->

    Thread Starter JakeThePeg

    (@jakethepeg)

    Hey again,

    I ended up hardcoding the navigation menu using straight HTML in the header.php file. Not ideal, but I don’t plan on changing the pages any time soon so no big deal I guess.

    I still would like to know if anyone can see any bugs in the php code (refer to last post) which is causing my navigation menu to appear pretty much empty.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Navigation menu problems – which file to hack?’ is closed to new replies.