WordPress.org

Support

Support » Plugins and Hacks » AZIndex » [Plugin: AZIndex] Sort by 2nd letter of a word

[Plugin: AZIndex] Sort by 2nd letter of a word

  • Currently AZindex sorts the index well, unless the 2nd caracter of a word has a non-alpha char, like an accent, example it does :

    Aaaa
    Abbb
    Aeeee
    Affff
    Aggg
    Aààààà
    Aééééé

    The words with accents go at the end of the list. You expect the accents the be removed before sorting.

    My hack :

    // line 1606 of file az-index-cache.php
    $sorthead = Unaccent($sorthead);

    Put this function in functions.php :

    function Unaccent($string)
    {
        return preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
    }

    Then, the sorting is fine :

    Aaaa
    Aààààà
    Abbb
    Aeeee
    Aééééé
    Affff
    Aggg

    http://wordpress.org/extend/plugins/azindex/

  • The topic ‘[Plugin: AZIndex] Sort by 2nd letter of a word’ is closed to new replies.
Skip to toolbar