WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] partial menu links not showing up (10 posts)

  1. chickspirit
    Member
    Posted 4 years ago #

    My menu links are only partially showing up on all my pages except the blog page where they are showing up as I'd like them.

    Can't for the life of me figure out what I need to adjust in the code to make the menu work properly on all pages.

    home: http://ktotheatothei.com (incorrect menu)
    blog: http://ktotheatothei.com/blog/ (correct menu)

    Here is the menu code in header.php

    <div id="menu">
    		<h1><a href="<?php bloginfo('url'); ?>"><b>KtotheAtotheI</b>.com</a></h1>
      <div></div>
    		<ul>
    			<li <?php if ( is_home() ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="<?php bloginfo('url'); ?>/about">ABOUT</a>
                 <?php if ( is_home() ) { ?>
    		<ul>
    			<li <?php if ( is_page(love) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/photos">PHOTOS</a></li>
    			<li <?php if ( is_page(about) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/video">VIDEO</a></li>
    			<li <?php if ( is_page(about) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/contact">CONTACT</a></li>
    			</ul>
    	</li><?php } else { ?></li><?php } ?>
    			<li <?php if ( is_page(blog) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="<?php bloginfo('url'); ?>/blog">BLOG</a>
                <?php if ( is_page(blog) ) { ?>
    		<ul>
    			<li <?php if ( is_page(love) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/photos">PHOTOS</a></li>
    			<li <?php if ( is_page(about) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/video">VIDEO</a></li>
    			<li <?php if ( is_page(about) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/contact">CONTACT</a></li>
    			</ul>
    	</li><?php } else { ?></li><?php } ?>
    			<li <?php if ( is_page(projects) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="<?php bloginfo('url'); ?>/projects">PROJECTS</a>
                <?php if ( is_page(about) ) { ?>
    		<ul>
    			<li <?php if ( is_page(love) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/photos">PHOTOS</a></li>
    			<li <?php if ( is_page(about) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/video">VIDEO</a></li>
    			<li <?php if ( is_page(about) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/contact">CONTACT</a></li>
    			</ul>
    	</li><?php } else { ?></li><?php } ?>
    		</ul>
    	</div>
  2. Peter Boosten
    Member
    Posted 4 years ago #

    Not quite sure, because all those nested if's make me dizzy, but I think you should be cleaning up some:

    <?php if ( is_home() ) { ?>
    		<ul>
    			<li <?php if ( is_page(love) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/photos">PHOTOS</a></li>
    			<li <?php if ( is_page(about) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/video">VIDEO</a></li>
    			<li <?php if ( is_page(about) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/contact">CONTACT</a></li>
    			</ul>

    You cannot be on is_page(love) when you're on is_home().

    My advise: make your code readable.

    Peter

  3. chickspirit
    Member
    Posted 4 years ago #

    Unfortunately this is how the code came with the theme I chose.
    The style.css is even worse. :o(

    Being a newbie, I'm more dizzy than you are and have no idea where to start cleaning it up.

    Can anyone at least point me in the right direction for how to fix my problem?

    Thanks.

  4. Peter Boosten
    Member
    Posted 4 years ago #

    Lets start simple (without all the if's):

    Before you start editing: make a copy of the original file, so you can always revert to the original situation.

    <div id="menu">
      <h1><a href="<?php bloginfo('url'); ?>"><b>KtotheAtotheI</b>.com</a></h1>
      <ul>
        <li> <a href="<?php bloginfo('url'); ?>/about">ABOUT</a></li>
        <ul>
          <li><a href="/photos">PHOTOS</a></li>
          <li><a href="/video">VIDEO</a></li>
          <li><a href="/contact">CONTACT</a></li>
        </ul>
        <li><a href="<?php bloginfo('url'); ?>/blog">BLOG</a></li>
        <li><a href="<?php bloginfo('url'); ?>/projects">PROJECTS</a></li>
      </ul>
    </div>

    Peter

  5. chickspirit
    Member
    Posted 4 years ago #

    Thanks for your patience Peter.

    I pasted in the code you wrote and PHOTOS, VIDEO, & CONTACT aren't showing up anywhere.

    But at least every page is behaving the same way so that's a start. :o)

    Kai

  6. Peter Boosten
    Member
    Posted 4 years ago #

    In your style.css, there is this section:

    #menu ul ul, #menu ul li.cur ul ul, #float {
      display:none;
    }

    change this into this:

    #menu ul ul, #menu ul li.cur ul ul, #float {
    /*  display:none; */
    }

    (just commenting the tingemy out, to see if it doesn't break anything else)

    Peter

  7. chickspirit
    Member
    Posted 4 years ago #

    Awesome! That didn't break anything it made the rest of the links show up. Yippee!!!!

    Now I just have to figure out how to get the rest of the styling back.

    That was so simple. Why make it crazy looking like that when you can just do what you suggested.

    My mind is boggled.

    Thanks Peter.

  8. Peter Boosten
    Member
    Posted 4 years ago #

    My mind is boggled.

    Kinda like Douglas Adams :-)

    Glad I could help.

    Peter

  9. olaurelee
    Member
    Posted 4 years ago #

    Hi, I'm also a newbie with the same problem! I used the same wordpress theme as Kai, and tried to use the same fixes but the transparent box behind my menu disappeared.
    Also (this is probably a really stupid question) i can't figure out how to change the menu links.. they're all messed up but I don't know where to start!

    here's what i've got so far:

    here's the code in my header as it is right now:

    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
    
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    <?php wp_head(); ?>
    </head>
    <body>
    <div id="menu">
      <h1><a href="<?php bloginfo('url'); ?>"><b>laurelevans</b>.com</a></h1>
      <ul>
        <li> <a href="<?php bloginfo('url'); ?>/about">ABOUT</a></li>
        <ul>
          <li><a href="/photos">PHOTOS</a></li>
          <li><a href="/video">VIDEO</a></li>
          <li><a href="/contact">CONTACT</a></li>
        </ul>
        <li><a href="<?php bloginfo('url'); ?>/blog">NEWS</a></li>
        <li><a href="<?php bloginfo('url'); ?>/work">WORK</a></li>
      </ul>
    </div>

    I'm a total beginner, forgive me!

  10. tmwalter
    Member
    Posted 4 years ago #

    I also had the disappearing box problem and found it's fix in the original header.php-code. You just have to fill in a "<div></div>" after the <h1>-part including your pagetitle:

    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
    
    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    <?php wp_head(); ?>
    </head>
    <body>
    <div id="menu">
                    <h1><a href="<?php bloginfo('url'); ?>"><b>AMY</b>&<b>PINK</b></a></h1>
                   <div></div>
                    <ul>
        <li> <a href="<?php bloginfo('url'); ?>/about">LINK left-1</a></li>
        <ul>
          <li><a href="/photos">LINK Right-1</a></li>
          <li><a href="/video">LINK Right-2</a></li>
          <li><a href="/contact">LINK Right-3</a></li>
        </ul>
        <li><a href="<?php bloginfo('url'); ?>/blog">LINK left-2</a></li>
        <li><a href="<?php bloginfo('url'); ?>/projects">LINK left-3</a></li>
      </ul>
    
            </div>

    I also included the answer to your link-editing question. ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags