• Can anybody help me fix my menu?

    Here’s my website https://www.gosolarsandiego.com/wordpress…

    And here’s my header.php file.

    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <title><?php
    	global $page, $paged;
    	wp_title( '|', true, 'right' );
    	bloginfo( 'name' );
    	$site_description = get_bloginfo( 'description', 'display' );
    	if ( $site_description && ( is_home() || is_front_page() ) )
    		echo " | $site_description";
    	if ( $paged >= 2 || $page >= 2 )
    		echo ' | ' . sprintf( __( 'Page %s', 'pursol' ), max( $paged, $page ) );
    	?></title>
    <link rel="profile" href="https://gmpg.org/xfn/11" />
    <link href="<?php bloginfo( 'stylesheet_url' ); ?>" rel="stylesheet" type="text/css" />
    <link href="<?php bloginfo('stylesheet_directory'); ?>/drop_menu.css" rel="stylesheet" type="text/css" />
    <script src="<?php bloginfo('stylesheet_directory'); ?>/js/stuHover.js" type="text/javascript"></script>
    <script src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="<?php bloginfo('stylesheet_directory'); ?>/js/cufon-yui.js" type="text/javascript"></script>
    <script src="<?php bloginfo('stylesheet_directory'); ?>/js/Century_Gothic_700.font.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    Cufon.replace(['#service ul li h3', '#about_we ul li h3 span', '#about_we ul li h3 small'], {fontFamily: 'Century Gothic', hover: true})
    </script>
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php
    	if ( is_singular() && get_option( 'thread_comments' ) )
    		wp_enqueue_script( 'comment-reply' );
    	wp_head();
    ?>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    
    <script type="text/javascript" src="scripts/fadeslideshow.js">
    </script>
    </head>
    
    <body>
    <!--Layout Start-->
    <div id="layout">
      <!--header Start-->
      <div id="header">
        <h1>Pursol Solar System</h1>
        <div class="logo"><a href="<?php echo home_url( '/' ); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/logo.jpg" alt="Pursol Solar Systems Inc." /></a></div>
        <div class="top_links">
    		<img src="https://gosolarsandiego.com/wordpress/wp-content/uploads/2012/08/phone26.jpg"></div>
    </div>
      <!--header End-->
      <!--Menu Start-->
      <div id="menu">
      <?php //wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'Top menu', 'menu', => 'Top menu' ) ); ?>
      <?php if($post->post_parent !=0)
    		  {
    		  	$varActiveHedaer = $post->post_parent;
    		  }
    		  else
    		  {
    		  	$varActiveHedaer = $post->ID;
    		  }
    		   ?>
        <ul id="menu-top-menu">
           <?php  $pages = get_pages('sort_column=menu_order&parent=0');
    	foreach($pages as $varPage)
    	{ ?>
        <li><a href="<?php echo get_page_link($varPage->ID) ?>"><?php echo $varPage->post_title; ?></a>
          <?php $second = get_pages('sort_orderby=>83,85,125,95,258,child_of='.$varPage->ID); ?>
          <?php if($second != array()){  ?>
    
            <ul class="sub-menu png">
             <?php foreach($second  as $varSecond){?>
                    <li><?php echo $varSecond->post_title; ?>
    
             <?php $third = get_pages('sort_orderby=>83,85,125,95,258,child_of='.$varSecond->ID); ?>
          <?php if($third != array()){  ?>
    
              <ul>
               <?php foreach($third  as $varThird){?>
              	 <li><a href="<?php echo get_page_link($varThird->ID); ?>"><?php echo $varThird->post_title; ?></a></li>
                 <?php }?>
              </ul>
              <?php }?>
              </li>
              <?php }?>
            </ul>
            <?php }?>
    
          </li>
          <?php }?>
        </ul>
      </div>
      <!--Menu End-->

    I need to change the top header order….and don’t know how to organize each submenu instead of having each parent display all the pages?

    Any help would be awesome!

    Thanks!

    Christina = )

Viewing 15 replies - 1 through 15 (of 21 total)
  • Thread Starter tinatinatina.ts

    (@tinatinatinats)

    This statement does not appear to be coded correctly:

    <?php $second = get_pages('sort_orderby=>83,85,125,95,258,child_of='.$varPage->ID); ?>

    Unless I am mistaken, there is no ‘sort_orderby’ parameter to get_pages().

    First try taking out that parameter:

    <?php $second = get_pages('child_of='.$varPage->ID); ?>
    Thread Starter tinatinatina.ts

    (@tinatinatinats)

    Hi I took out that argument and replaced it with the one given..Thanks!

    Do you know how I can get the top menus to read in this order

    Residential /Commercial /Pursol Advantage /About Us /Account Login

    and also each heading is displaying all my pages as the submenus I’m not sure why it’s doing that?

    Thanks so much for your help!

    Is there some reason you are not using the built-in WP Menu system? The wp_nav_menu() call is commented out and replaced with a lot of other code.

    I think you have more control over the menu with the built-in system unless you are a programmer. If you did not create the code, you might want to consider switching back.

    Thread Starter tinatinatina.ts

    (@tinatinatinats)

    Yea…I’m not sure why I am unable to use the wp menu system? Do you know what code I need to input to use it?

    If you go to Admin->Appearance->Menus, is there a ‘Theme Locations’ box in the upper left where you can assign a menu to a location?

    EDIT: It may be more complicated than I described below to switch to the menu system. I will need to look further.

    If so, you should be able to use the menu system by changing this:

    <?php //wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'Top menu', 'menu', => 'Top menu' ) ); ?>
      <?php if($post->post_parent !=0)

    to this:

    <?php wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'Top menu', 'menu', => 'Top menu' ) ); ?>
      <?php if( false && $post->post_parent !=0)

    You will need to create the ‘Top menu’ if it does not already exist. Here is a video tutorial on the menu system if you need it:

    https://ericasays.com/2984/wordpress-3-custom-menu-tutorial/

    OK, you will need to remove a bunch of lines of code. MAKE A BACKUP COPY FIRST!!!

    Then take out everything between this:

    <!-- Menu Start -->
    <div class="menu";
       <?php //wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'Top menu', 'menu', => 'Top menu' ) ); ?>

    and this:

    </div>
    <!--Menu End-->

    and uncomment the wp_nav_menu() call, leaving just this:

    <!-- Menu Start -->
    <div class="menu";
       <?php wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'Top menu', 'menu', => 'Top menu' ) ); ?>
    </div>
    <!--Menu End-->
    Thread Starter tinatinatina.ts

    (@tinatinatinats)

    Thanks so much! I understand everything you told me to do except for

    “uncomment the wp_nav_menu ()call?”

    Take out the two slashes before wp_nav_menu. See how they were there in the top snippet but gone in the final one?

    One other caution – I don’t really know the purpose of the custom menu code, so check the site carefully for odd appearances after you get the new menu working.

    Thread Starter tinatinatina.ts

    (@tinatinatinats)

    Hi,

    I made the changes and am getting this error code?

    Parse error: syntax error, unexpected T_DOUBLE_ARROW, expecting ‘)’ in /home/donnaagu/public_html/gosolarsandiego.com/wordpress/wp-content/themes/pursol/header.php on line 52

    There is an extra comma after the word ‘menu’ in the wp_nav_menu() line. It should be this:

    <div class="menu";
       <?php wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'Top menu', 'menu' => 'Top menu' ) ); ?>
    </div>

    You might want to look for a different theme. This one seems to have a lot of quirks and downright errors.

    OK – my mistake. Please change the menu code to be this:

    <!-- Menu Start -->
    <div id="menu">
       <?php wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'Top menu', 'menu' => 'Top menu' ) ); ?>
    </div>
    <!--Menu End-->
    Thread Starter tinatinatina.ts

    (@tinatinatinats)

    Thanks so much for everything!

    If you go to my site this is what the changes did….

    https://www.gosolarsandiego.com/wordpress

    There are no spaces in the top headings I’m not sure why but i’m basically trying to make my site look like this

    https://web.archive.org/web/20110202171205/https://www.pursolsolar.com/

    You can click off the top “x” to close the extra pop-up and then view the menu there…

    That was my old site…and I forgot to backup certain things and had to start making a new one trying to copy my old one. We transfered domains and lost some data.

    The new code I placed into the header lets me use the backend wp menu system! Thanks so much for all your help! If you can help me any further that would be awesome…

    Did you make the last change where I found a mistake that I made? Change the menu code to be this:

    <!-- Menu Start -->
    <div id="menu">
       <?php wp_nav_menu( array('container_class' => 'menu-header', 'theme_location' => 'Top menu', 'menu' => 'Top menu' ) ); ?>
    </div>
    <!--Menu End-->

    You will need to style the menu to make it look better.

    I can see why the custom menu code was there when I look at the old site. The new one will be very similar, but it will not be exactly the same.

    Make the change above and I will look again.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Organize Drop Down Menu?’ is closed to new replies.