2006-04-01 18:59Did my sidebar always look like that?Make it stop! For a while now, the top section in my sidebar has been taunting me with its incorrect formatting. I had noticed that the title of that section was marked up as <h2>, possibly since the upgrade, and I’ve been meaning to fix it. I thought this would just be a case of changing the sidebar.php file, but on closer inspection it was clear that the extraneous markup was being added elsewhere. Here is roughly how I found out which part of WordPress to change, and what the change was. The first step was to check the HTML source against the PHP in sidebar.php. The relevant PHP was <!— begin sidebar —> <div id="menu"> <ul> <?php wp_list_pages(); ?> <?php get_links_list(); ?> <li id="categories">… which meant that the two function calls Narrowing it down to two functions should make it trivial, but I had to find which files these functions were in first. To do this I logged in to my host over SSH and ran a command like this: for i in `find -type f`; do grep -H ‘wp_list_pages()’ $i; done
Relatively quickly I found the files, in particular wp-includes/links.php which contained the following line: The necessary change, therefore, was this: echo ‘ <li id="linkcat-‘ . $cat[‘link_category’] . ‘"><!— <h2> —>’ . $cat[‘cat_name’] . ":<!— </h2> —>\n\t<ul>\n"; Life is never actually that simple, and I did in fact try some things which were ultimately unhelpful, but in future I should be as quick as that explanation implied. Also, now I’ve blogged the change, it should be pretty quick to apply it to a new version of WordPress — I just hope that won’t be for a while… Did I mention the 2,0,2 upgrade? Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
Annoyingly everything has changed around during one of the WordPress upgrades, and when I noticed the missing colon after the name of the top category I had to go through this process pretty much from scratch.
Eventually I managed to find the file:
./wp-includes/bookmark-template.php
because it contained the string:
rel="
without a <link> tag on the same line, just like the hyperlinks to other blogs in my sidebar. The PHP contains that string in the function:
_walk_bookmarks
which is called on line 339 of that file, so I added a colon to line 338 thus:
$output .= "$title_before$cat->cat_name$title_after:\n\t<ul>\n";
|
QuicksearchCategoriesSyndicate This BlogBlog Administration |