PDA

View Full Version : CSS help



Blam
15-01-2009, 09:19 PM
My friend tom is having a CSS/PHP problem with his wordpress theme that neither me or himcan fix. He's trying to create a dynamic menubar, as demonstrated here: http://codex.wordpress.org/Dynamic_Menu_Highlighting . The only thing that doesn't work is the highlighting of the page that you're currently on. Here's his CSS:



#current{
text-color: #FFFFFF;
}

#navmenu ul{
float: center;
margin: 0 0 0 50px;
padding: 0;
list-style-type: none;
list-style-image: none;
}

#navmenu li{
display: inline;
font-family: Georgia, Sans-Serif;
font-size: 50px;
}

#navmenu ul li a {
font-family: Georgia, Sans-Serif;
font-size: 50px;
text-decoration: none;
margin: 4px;
padding: 5px 20px 5px 20px;
background: #393939
}

#navmenu ul li a:hover {
text-decoration: none;
margin: 4px;
padding: 5px 20px 5px 20px;
background: #292929;
}

and here's his PHP:


<div id="navmenu">

<ul>
<li<?php if (is_home()) {echo " id=\"current\"";} ?>>
<a href="<?php echo get_settings('home'); ?>">home</a></li>
<li>/</li>
<li<?php if (is_page('about') || is_single() && !in_category('2')) {echo " id=\"current\"";}?>>
<a href="?page_id=2/">about</a></li>
<li>/</li>
<li><img src="/images/header.png"></li>
<li<?php if (is_page('portfolio') || is_single() && !in_category('10')) {echo " id=\"current\"";}?>>
<a href="?page_id=10/">portfolio</a></li>
</ul>
</div>

can anyone spot a problem?

Cheers,
Blam&Tom

cascade
15-01-2009, 10:34 PM
I hope this will help you out

notice the bold codes




#navmenu ul li a#current {
color: #FFFFFF;
}

#navmenu ul{
float: center;
margin: 0 0 0 50px;
padding: 0;
list-style-type: none;
list-style-image: none;
}

#navmenu li{
display: inline;
font-family: Georgia, Sans-Serif;
font-size: 50px;
}

#navmenu ul li a {
font-family: Georgia, Sans-Serif;
font-size: 50px;
text-decoration: none;
margin: 4px;
padding: 5px 20px 5px 20px;
background: #393939
}

#navmenu ul li a:hover {
text-decoration: none;
margin: 4px;
padding: 5px 20px 5px 20px;
background: #292929;
}




<div id="navmenu">

<ul>
<li>
<a href="<?php echo get_settings('home'); ?>" <?php if (is_home()) {echo " id=\"current\"";} ?>>home</a></li>
<li>/</li>
<li>
<a href="?page_id=2/" <?php if (is_page('about') || is_single() && !in_category('2')) {echo " id=\"current\"";}?>>about</a></li>
<li>/</li>
<li><img src="<?php bloginfo('template_url'); ?>/images/header.png"></li>
<li>
<a href="?page_id=10/" <?php if (is_page('portfolio') || is_single() && !in_category('10')) {echo " id=\"current\"";}?>>portfolio</a></li>
</ul>
</div>

Sel
15-01-2009, 11:34 PM
This is Tom- thanks for your help cascade, the navbar now works :banana! in fact, have a :clap as well!

cascade
16-01-2009, 08:02 AM
np mate :)