WordPress.org

Ready to get started?Download WordPress

Forums

AZIndex
Sort by 2nd letter of a word (1 post)

  1. nicomollet
    Member
    Posted 3 years ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags