(Advanced?) Theming question
-
Hi all,
I have a problem with the way WP handles some links and it seems that the only way around this is modifying a WP core function. Since I’m trying to design my site by only touching the “theme” PHP & CSS, I was wondering if there was another way of doing things.
Here’s the deal. I’ve modified the sidebar’s appearance so that when you hover a link, you get a nice full-width background-colored bar. CSS looks like this:
div#sidebar ul li a {
color: #333;
padding: 0 0 0 20px;
border: none;
margin: 0;
display: block;
width: 170px;
}
div#sidebar ul li a:hover {
background-color: #aaa;
color: #fff;
}
This works fine for everything, except for the categories links. What WP created is a list-item which looks like this (excuse the href tags, the forum keeps converting my ‘a’ to links…):
<list>
<href href=”https://192.168.0.4:8888/?cat=2″ title=”View all posts filed under Category”>Category</href> (1)
</list>The number of posts (here 1) is outside the link, and therefore breaks my hover effect. Moreover it looks pretty depressing since there is a line break (the number is added below the category name).
I can modify the style for the category posts number but I don’t think I’ll ever get it to appear right next to the name, with the block hover functioning properly.
The only thing that would seem to solve this problem is modifying the wp_list_cats() function in template-functions-category.php, inside the includes folder, so that the number of posts is added within the link tag itself. But I’d rather not do because I’m afraid of breaking things and also because it will make upgrades to WP very annoying.
Since a lot of people are deeply customizing WP, I would like to know if there is a safe way to accomplish this.
Almost total newbie here, so please bear with me ??
Thanks.
- The topic ‘(Advanced?) Theming question’ is closed to new replies.