Support » Fixing WordPress » get_links_list now inserts h2?

  • Does anyone else think this is a mistake? It completely wrecks my headline element hierarchy. Maybe I’m just an HTML queen.

Viewing 15 replies - 1 through 15 (of 26 total)
  • Can you post a link to your site? looks fine for me…

    Screws up my site as well – but not because of the H2, instead the li tags mean I have to put it within a ul – as it is already part of a ul the links appear way too small.

    Is this expected behaviour and if so, why is it not the same for the archives?

    I think I have the same Problem. My old WordPress 1.22 Blog posts the link categories in smaller subheader (look at But now with Wp 1.5gamma with the same options for the sidebar, the categories are posted as top level header with <h2> (look at

    How can I change the behavior in 1.5 to that in 1.22?

    It’s not WordPress that is doing this. It’s the CSS that is styling the text in this way.

    NuclearMoose: Agreed. The CSS can be changed so no visual difference is detected.

    RSL’s post, I think, though was about header hierarchy. I admit, it is not terribly important to me, but I recognize some people are very serious about it. And rightfully so: search engines notice headers, it’s more semantically correct, … I’m sure there’s other good reasons, but those are certainly good enough.

    There’s really no need to have the h2 in the tag. It was a concession to Kubrick, as I see it, that made creating lists of links that were compatible with Kubrick’s CSS a matter of a simple tag rather than tag(‘<h2>‘,”,’</h2>‘) or whatever it is.

    Kubrick is the default template, now, but should it determine how tags are written?

    I have the same problem. Because of line 563 in wp-includes/links.php.


    echo ' <li id="'.sanitize_title($cat['cat_name']).'"><h2>' . stripslashes($cat['cat_name']) . "</h2>\n\t



    echo ' <li id="'.sanitize_title($cat['cat_name']).'">' . stripslashes($cat['cat_name']) . "\n\t


    work fine (just by stripping <h2> and </h2>).


    I had to change it to that, otherwise he would post a bullet before each following categorie header:

    echo ‘ <li id=”‘.sanitize_title($cat[‘cat_name’]).'”>’ . stripslashes($cat[‘cat_name’]) . “\n\t\n”;
    // Call get_links() with all the appropriate params

    • ‘,”
    • “,”\n”,

      // Close the last category
      echo “\n\t\n\n”;

      The closing tags in the last line have to be deleted.

    Thread Starter RSL


    I know enough CSS to change how it LOOKS on the page. A couple of ul+ul selectors and it APPEARS that it’s not a problem. The problem is the semantic markup is completely shot.

    Thread Starter RSL


    I do agree with kapeka about the calling each category by name. It’s a huge pain, but short of including a hacks.php kind of file with your theme it’s the only way to do it without breaking the functionality of other themes in your wordpress install. I’ll say it again [a little clearer]: hacking links.php itself is NOT the way to go. doing so WILL cause problems with the layout [read: CSS styling] of other themes, including the default. Better to call your links from get_links() or [for the brave-ish] hacking the function in some kind of manually included php file in your theme. Those of you who don’t understand what I’m talking about in that last part can forget I even mentioned that.

    O.K., RSL, maybe you are with that, that hacking links.php is not the best way to solve that problem (or maybe in your eyes, it’s absolutly no way at all), but I only use one theme, the default one. I think nobody thinks, it should be solved that way in WP generaly. But until they find a way to get it work, it’s a passable hack. And if I hack my WP Blog it has no influence on other blogs. And as long as my style is correct, I see no problem.

    P.S.: Sorry for the corrupt comment up here. I forgot to change the tags.

    P.S.S.: I finaly just have copied the passage from the links.php in WP 1.22 and now it works like before.

    I agree wholeheartedly that semantics should be applied when and where possible. My question, however, is what is the argument against using a second-level headline as the title for categories and link sections? What are your suggestions as to what it should be otherwise, given the importance of these titles as both visual and structural elements of the design?

    I’d like to note, thatg having the header tag on there is actualy MORE semanticaly correct. That’s what the category name is doing there, it IS the header for that group. To remove it makes it less semanticly right. If it’s an issue of it not looking right, then the CSS needs to be updated to display the header correctly.

    “But until they find a way to get it work, ” — but it DOES work. It isn’t broken in any way shape or form. It just happens to be not the way you want it to be.


    Sure, TG, you are right. I just compared it to WP 1.22. But in my mind it makes more sense to have it like in WP 1.22.
    All the categories are under one main headline. Why should all the link categories now be sorted in another way?
    The second header tag introduces a new section in the sidebar.
    One section is the archives section. Another is the Categories section. And one section is the Link Section, or the blogroll, or how you want to call it. And in this section i have all my links.
    If every link categorie got its own h2 header it breaks this system.
    And like I have it on my Blog and like it is managed in the kubrick theme in wp 1.22 you have all the link categories clearly marked as categories. I see no Problem in managing it that way.

    Ah, I think I understand now. I don’t run into that prob since I control mine on a category by category basis (to control the link cat order and the # of links) so it’s less of an issue with me, but I think I understand what you are talking about now.


    Thread Starter RSL


    A simple solution is to change the get_links_list function to take an h-whatever level element as well. I’m sure I’m explaining this all wrong, but the new version of the function could look like get_links_list(“id”, “<h4>”, “</h4>”) and apply those heading levels to the output just like the hardcoded h2 is now. Does that make sense?

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘get_links_list now inserts h2?’ is closed to new replies.