WordPress.org

Ready to get started?Download WordPress

Forums

get_links_list now inserts h2? (27 posts)

  1. RSL
    Member
    Posted 9 years ago #

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

  2. tcloer
    Member
    Posted 9 years ago #

    Can you post a link to your site? swimcommunity.org/blog looks fine for me...

  3. tom_raftery
    Member
    Posted 9 years ago #

    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?

  4. kapeka
    Member
    Posted 9 years ago #

    I think I have the same Problem. My old WordPress 1.22 Blog posts the link categories in smaller subheader (look at http://karl.karzelek.com/xrossblog). 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 http://karl.karzelek.com/senf).

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

  5. NuclearMoose
    Member
    Posted 9 years ago #

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

  6. Michael Adams (mdawaffe)
    Member
    Posted 9 years ago #

    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?

  7. slyShark
    Member
    Posted 9 years ago #

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

    Changing

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

      \n";

      to

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

        \n";

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

        Regards,
        Coshkun.

  8. kapeka
    Member
    Posted 9 years ago #

    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
    get_links($cat['link_category'],
    '

  9. ',"
  10. ","\n",
    bool_from_yn($cat['show_images']),
    $orderby,
    bool_from_yn($cat['show_description']),
    bool_from_yn($cat['show_rating']),
    $cat['list_limit'],
    bool_from_yn($cat['show_updated']));

    // Close the last category
    echo "\n\t\n\n";

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

  • RSL
    Member
    Posted 9 years ago #

    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.

  • RSL
    Member
    Posted 9 years ago #

    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.

  • kapeka
    Member
    Posted 9 years ago #

    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.

  • NuclearMoose
    Member
    Posted 9 years ago #

    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?

  • TechGnome
    Moderator
    Posted 9 years ago #

    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.

    Tg

  • kapeka
    Member
    Posted 9 years ago #

    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.

  • TechGnome
    Moderator
    Posted 9 years ago #

    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.

    Tg

  • RSL
    Member
    Posted 9 years ago #

    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?

  • RSL
    Member
    Posted 9 years ago #

    kapeka: I wasn't critiquing your idea. I rather agreed with it. I was telling other people who might not be using only one theme or whatever that there were indeed dangers in hacking that file directly. A little insurance, if you will, so that I didn't get accused of destroying anyone else's site. ;)

  • kapeka
    Member
    Posted 9 years ago #

    Now I get it. In german we say "A light flashes up" if someone understands something. I think it's quite bright in this room now, cause some lights are flashing up ;-)

    Your Idea is good, RSL. I think this would be a good way to manage that problem. I thought in the same way making it optional how the link categories are styled.

  • Halden
    Member
    Posted 9 years ago #

    I was racking my brain as to why all of a sudden so titles were bigger. Slysharks fix was perfect.

  • michaelc
    Member
    Posted 9 years ago #

    I have to agree that as it stands, the ability to easily customize simple text formatting is "broken" for Links. I can put in the work to get around the limitation (now that I know where the problem is - thanks for that), but this definitely makes WP harder to use for those trying to customize their own pages.

    If a formatting attribute must be hard-coded (for programming ease, I presume) it should use unique attributes that can be changed in style.css, independently of other items on the page (that is, no h2 or li). Maybe a fix - sorry, "feature enhancement" - for 1.5.1...

  • drewgood
    Member
    Posted 9 years ago #

    I'm getting bullet points on my

  • Root
    Member
    Posted 9 years ago #

    Forgive me for saying so but although it may appear inconvenient there are sound reasons for employing the h2 tags , notwithstanding the fact it is inconsistent with the remainder. Matt likes to throw in the odd CSS challenge. Once we quit ranting and concentrate it is not difficult to fix.

  • klklaser
    Member
    Posted 9 years ago #

    H2 is more semantically correct? That would be like exchanging the usual ordering of a book's Bibliography and Table of Contents!

    NuclearMoose asked excellent questions ( #post-129807 ), and RSL's idea ( #post-129834 ) would give users the needed flexibility.

  • meifong16
    Member
    Posted 9 years ago #

    the easiest way to change the way the list looks is through the css file without touching the links.php at all as already said, it might affect other templates.

  • jeremycherfas
    Member
    Posted 9 years ago #

    I fixed the CSS to restore the look I had before upgrading to 1.5, thanks to the advice in this thread, but I wonder whether the semantic whizzes here reckon that one should be consistent about all the heading levels in a sidebar. Should pages, Other, Meta and Categories all be in H2 tags?

    Jeremy

  • OtherMichael
    Member
    Posted 9 years ago #

    things like http:// suddenly showing up before my relative (or in-house) URIs and <h2> tags appearing where I don't want them....

    is irritating.

    markup tags should not be hidden deep within the software where users cannot change them. I want to control the horizontal and vertical, and not let the software do it.

  • meganano
    Member
    Posted 8 years ago #

    If the get_links tag creates an <h2> tag, then why don't similar tags like the ones for category and archive do the same thing?

    here's the differene as reflected on my site:

    sidebar.php:

  • <?php get_links_list(); ?>
  • results in:
    <li id="linkcat-1"><h2>People I know</h2>

    sidebar.php:
    <li id="categories"><?php _e('Categories:'); ?>

    results in:
    <li id="categories">Categories:

    Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags