• Hi!

    I’m having a weird problem with using WP own tagcloud. It seems that alphabetic sorting is not suported for languages that are using non-English characters.
    For example: Our language is using a “?” (c with scaron) which is positioned beetwen “c” & “d” in alphabet. But wp_tag_cloud() function bring tags with “?” at the start, before “a” words. Same goes for “?”(s with scaron) and “?” (z with scaron).

    the_tags() instead works perfectly. It sorts the tags in right alphabetic order.

    It seems that wp_tag_cloud() is not considering “international” characters as the_tags().

    Is there anyone that solved this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter alains

    (@alains)

    just a bump

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    WordPress uses the strnatcasecmp function for ordering tag by name, so this is purely a PHP problem, really.

    You might try adding a setlocale() statement to the wp-config.php file, to set your locale to the correct language. That will make PHP do the character comparisons correctly (if it can). However, I have no way to know what else that will affect in WordPress. It may have some other side effects as well. Be prepared for anything.

    Thread Starter alains

    (@alains)

    Thanks Otto42 for poining out a possible solution.
    But it’s still interesting that the_tags() is working properly. Maybe if I try to find what is done there and then aply it to wp_tag_cloud()? But I’m not into PHP really …so I’ll try to find out and maybe actually solve it.
    Of course if some PHP freak knows how to solve this…don’t be afraid ??

    Thread Starter alains

    (@alains)

    So far…so bad ??
    It seems that possible solutions found on the web and yours Otto42 were not able to solve this problem.

    I’m really pissed off as this means a “semi-functional” tag cloud.

    I still don’t get it why “strnatcasecmp” is used for wp_tag_cloud() and not for the_tags() which is working perfectly with non-english characters.

    But as usual I’m waiting for one WP code freak out there to see my SOS ??

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    the_tags() is just retrieving a list of tags for the post. It uses the sorting in mySQL.

    The tag cloud, on the other hand, has more work to do, so it has to do the sorting itself in PHP.

    This could be fixed with some effort, but not with minor effort.

    Now it is version 2.5 time and still the tag cloud isn’t sorting well. Thats really bad.
    And I don’t think one should point the finger to the ignorant php function. It just has to be corrected by using some other function.
    Is there demand from other europeans to solve this? I really would try if it will be included in some later release.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Wrong alphabetic sorting with wp_tagcloud()’ is closed to new replies.