How to change category link display in pages
-
Hi there,
I made a menu composed with wp_category_list that lists category links I want, I use some css for rollover effect, etc.
Now, I want to change category link display in pages “I am in” (for ex. background of portfolio link in white rather than black when I am in portfolio page).
For this I defined the #current and #notcurrent in my css stylesheet but problem is that the following code works like this :<div id="navmenu" align="right"> <ul> <li<?php if ( in_category(3) ) { echo " id=\"current\""; } else { echo " id=\"notcurrent\""; } ?>><a href="https://localhost/wordpress/?cat=3" target="_self">folio</a></li>
but not with wp_list_category:
<div id="navmenu" align="right"> <ul> <li<?php if ( in_category(5) ) { echo " id=\"current5\""; } else { echo " id=\"notcurrent5\""; } ?>><?php wp_list_categories('include=5&title_li='); ?></li>
Here is the css:
#navmenu ul { margin: 0; padding: 0; list-style-type: none; list-style-image: none; } #navmenu li { display: inline; } #navmenu ul li a { font-size:7pt; text-decoration: none; margin: 8px; padding: 2px 5px 2px 5px; } #navmenu ul li a:hover { font-size: 7pt; text-decoration:none; color: #ffffff; background-color:#ff00a4; } #navmenu { position: relative; right: 30px; padding:80px 0 0 198px; } #current a { color:#ffffff; background-color: #ff00a4; } #notcurrent a { color:#000000; }
Hope someone will be able to give me an hand on this, thanks.
[title moderated MH]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to change category link display in pages’ is closed to new replies.