WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] New pages not referencing header.php correctly? (10 posts)

  1. whoisandy
    Member
    Posted 3 years ago #

    I haven't updated my site in a couple years so I am starting to revise it through wordpress 3.0.1. I have "CityDreams" theme/template from AMYPINK (Site is NSFW - artsy nudes)

    1st Problem:
    I modified the header.php to accommodate the links I want. On my index page (whoisandy.net), I have the menu how I want it, in those 2 sections. However, when I create a new page, all the templates (links, default, homepage, archive) only carry over the left column of my menu even though all pages including the index, contain the same code: <?php get_header(); ?>

    Could somebody explain why this is? I'm confused.

    2nd Problem:
    I edited the links from the header.php until they were to my liking. There were 4 links in 2 columns. I only need 3 links in the 2 columns. The problem when omitting one in each column, it' didn't bring the columns down to the bottom line, it stayed at the top which doesn't look right in the design of the menu. So, with the little experience I have and some detective work, I figured the way to edit this was in the style.css file. I was able to knock down the lines a couple px so they lined up with the "WHOISANDY" title to the left. However, it messed up the link navigation and hover as you can see. I cannot find where to modify that so the hovering (mouse over) links match back up again. On line 157, this is where I modified the line height to 33px so all the text sits at the height I want it, but now the hover/link highlight is incorrect. I can attach the style.css and perhaps someone could shed some light onto this situation as well. Thank you for any and all help, if I forgot to include any information, just let me know. Thank you again.

    style.css file on pastebin

  2. Digital Raindrops
    Member
    Posted 3 years ago #

    Hi Andy,
    Running the URl through that validator brought up a three errors.

    As these are the menu elements not closed in correct sequence, have another look at the changes you made in the header.php

    HTH

    David

  3. whoisandy
    Member
    Posted 3 years ago #

    Thanks for the help, David. Using the validator, I repaired all code and it now passes the validation. I was able to get a step forward with my menu issue but also took a step back..

    After cleaning up the code, the menu is now coming through on all new pages - finally! This is good news but I broke the 2 column menu setup I had before. It's now just one. It looks like in the template, he used an if/else statement to break the menu up. In repairing my header code, I took these out because it was giving me the first error I mentioned and I am unsure how to re-build it properly.

    This is the code that was working on the index page but wasn't coming through on any new pages. Is there a way I can re-write this? I want to always have the 2nd column that lists work, photos, and contact.

    <div id="menu">
            <h1><a href="<?php bloginfo('url'); ?>"><b>WHO</b>IS<b>ANDY</b></a></h1>
            <div></div>
            <ul>
                <li <?php if ( is_home() ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="<?php bloginfo('url'); ?>/">NEWS</a>
                 <?php if ( is_home() ) { ?>
            <ul>
                <li <?php if ( is_page(work) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/work">WORK</a></li>
                <li <?php if ( is_page(photos) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/photos">PHOTOS</a></li>
                <li <?php if ( is_page(contact) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/contact">CONTACT</a></li>
            </ul>
        </li><?php } else { ?></li><?php } ?>
                <li <?php if ( is_page(resume) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/resume">RESUMÉ</a>
                <?php if ( is_page(about) ) { ?>
        </li><?php } else { ?></li><?php } ?>
                <li <?php if ( is_page(reel) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/reel">DEMO REEL</a>
                <?php if ( is_page(about) ) { ?>
        </li><?php } else { ?></li><?php } ?>
            </li>
            </ul>
        </div>

    I am far from a pro but it looks like the way he wrote this is to only show the 3 extra links IF on the home page (news). ELSE, just show resume and reel. I can't figure out a way to remove the if/else and keep the 2 columns of all links at all times. Perhaps I am missing something. If anyone could point me in the right direction, would be greatly appreciated. Thank you.

  4. whoisandy
    Member
    Posted 3 years ago #

    UPDATE: I jumped the gun and posted a quick fix I had done but it turned out to be a fluke. Still trying to get the above figured out...

  5. whoisandy
    Member
    Posted 3 years ago #

    Well, I've spent all weekend trying to figure this stuff out and still haven't got it. I have searched and experimented so much with this, my head is 2 seconds away from exploding. I just have ONE more question:

    The main menu is displayed correctly on the main page but clicking on the links (try 'contact' for example), the menu (header.php) changes. It's missing the right side. This is what the code currently looks like. I can't figure out what I have to do to keep the menu the same throughout the main page and all other pages. What is wrong with it? Is there something else I'm missing?

    <?php wp_head(); ?>
    </head>
    <body>
    <div id="menu">
    		<h1><a href="<?php bloginfo('url'); ?>"><b>WHO</b>IS<b>ANDY</b></a></h1>
    		<div></div>
    	<ul>
    			<li <?php if ( is_home() ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/">NEWS</a>
    	<ul>
    		<li <?php if ( is_page(work) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/work">WORK</a></li>
    		<li <?php if ( is_page(photos) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/photos">PHOTOS</a></li>
    		<li <?php if ( is_page(contact) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/contact">CONTACT</a></li>
    	</ul>
    	</li>
    		<li <?php if ( is_page(resume) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/resume">RESUMÉ</a>
    <ul>
    		<li <?php if ( is_page(work) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/work">WORK</a></li>
    		<li <?php if ( is_page(photos) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/photos">PHOTOS</a></li>
    		<li <?php if ( is_page(contact) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/contact">CONTACT</a></li>
    	</ul>
    	</li>
    		<li <?php if ( is_page(reel) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/reel">DEMO REEL</a>
    <ul>
    		<li <?php if ( is_page(work) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/work">WORK</a></li>
    		<li <?php if ( is_page(photos) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/photos">PHOTOS</a></li>
    		<li <?php if ( is_page(contact) ) { ?>class="cur"<?php } else { ?><?php } ?>><a href="/contact">CONTACT</a></li>
    	</ul>
    	</li>
            </ul>
    	</div>
  6. Ryan Paul
    Member
    Posted 3 years ago #

    There's probably something missing on your page.php or whatever it is.

    Why are you using all those php conditionals for adding classes, when WordPress does it automatically?

  7. whoisandy
    Member
    Posted 3 years ago #

    It's the way the template was and seems to be the only way it works I'm afraid. It's the only theme I liked but I don't think it's built conventionally.

    The way the menu is, it's done manually this way, I believe. In the wordpress admin, under appearance/menus, there are no menus there and it says "The current theme does not natively support menus, but you can use the 'Custom Menu' widget to add any menus you create here to the theme’s sidebar."

    I think this is why I have to have all the php conditionals. Do you think I can just add conditionals to the remaining 3 and it should work?

    UPDATE: added conditionals to the remaining 3 pages manually and it seems to be working now.

  8. Digital Raindrops
    Member
    Posted 3 years ago #

    Seems to be ok now?

    David

  9. whoisandy
    Member
    Posted 3 years ago #

    Hi David,
    Yes, I just added those php conditionals like the first 3 links have and adjusted them for the last 3 (work, photos, contact). Now the menu is consistent throughout. This theme is just a pain to work with as it wasn't built to be easily customized. I'm working through it, though. Thank you guys for the help.

    - Andy W.

  10. Ryan Paul
    Member
    Posted 3 years ago #

    Dude you should use WordPress menus feature and then customize your CSS to suit.

Topic Closed

This topic has been closed to new replies.

About this Topic