Support » Plugin: A-Z Listing » Again about UTF-8 and the display at #

  • Resolved sipoax



    I read pretty much everything written here. I couldn’t find a solution to my problem.

    Some of the titles of my articles start with diacritics (Șș, Țț, Îî).

    I put this code in the article where I want to display the index: [az-listing display = “posts” alphabet = “AÁÀÄaáàä, Ăă, Ââ, Bb, CÇcç, Dd, EÉÈËÊeéèëê, Ff, Gg, Hh, IÍÌÏiíìï, Îî, Jj , KK, LL, MM, NN, oooooooooo, PP, QQ, RR, Ss, Șș, TT, Țț, UÚÙÜÛuúùüû, Vv, Ww, Xx, Yy, Zz “]

    At the top where the alphabet is displayed the diacritics (Șș, Țț, Îî) appear, but below where the links are displayed the articles starting with diacritics are displayed at #.

    I mention that I checked and mbstring is active.

    Isn’t there a solution to introduce some filter in function.php so as to force articles starting with diacritics (Șș, Țț, Îî) to be displayed in (Ss, Tt, Ii)?

    PS: I also tried with alphabet = “AÁÀÄÂaáàäâ, Bb, Cc, Dd, EÉÈËÊeéèëê, Ff, Gg, Hh, IÍÌÏÎiíìïî, Jj, Kk, Ll, Mm, Nn, OÓÒÖÔoóòöô, Pp, Qq, Tr, S, T r , Vv, Ww, Xx, Yy, Zz “the result is the same, indexing articles with diacritics at #

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Daniel Llewellyn



    Please copy and paste the exact shortcode from your site. Make sure when you paste the shortcode into the reply box that you use the editor’s “code” feature to correctly mark your input as code. This will ensure that the editor does not mangle the characters you input, such as changing " to , which it has done in your original post.

    I tried both codes below:

    [a-z-listing display="posts" alphabet="AÁÀÄaáàä,Ăă,Ââ,Bb,CÇcç,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏiíìï,Îî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,Ssß,Șș,Tt,Țț,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz" post-type="page"]

    [a-z-listing display="posts" alphabet="AÁÀÄÂĂaáàäâă,Bb,Cc,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏÎiíìïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,SsßȘș,TtȚț,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz" post-type="page"]

    The first code to differentiate Șş from Ss, Țț from Tt, Ăă from Aa, Ăă from Aa, Îî from Ii.

    The second to try to include Șş in Ss, Țț in Tt, Ăă in Aa, Ââ in Aa, Îî in Ii

    The result is the same: articles are entered at #

    Plugin Author Daniel Llewellyn


    Both of those variants look like they should work. Is it possible that the added letters with diacritics are a different unicode code-point to the first letter of your pages? To be sure you could try copying the first letter of an affected page’s title from the edit-page screen and then paste that into the alphabet. If that still fails, I’m unsure what the problem is…

    ignore this message, see the following message!

    I think I found the problem, but I don’t know how to fix it.

    I use the OceanWP theme and I use the child theme. With the child theme enabled, the problem above appears. If I only activate OceanWP (without the child theme) the AZ Listing theme it works perfectly.

    Maybe you have any suggestions?

    • This reply was modified 2 months, 1 week ago by sipoax.
    • This reply was modified 2 months, 1 week ago by sipoax.

    Hmmm It’s my fault. Your plugin works perfectly.

    I checked function.php and found that I had added a few lines of code. Looks like something is not ok with what I added.

    add_filter( 'a_z_listing_item_index_letter', 'my_a_z_index_filter', 10, 3 );
    function my_a_z_index_filter( $index_letters, $item, $item_type ) {
        // make sure we're filtering the right post type
        if ( 'page' === get_post_type( $item ) ) {
            // pull the title and get the first letter of the second word
            $full_name = explode( ' / ', $item->post_title );
            // the last word is in the last element of $title_parts so check it is there
            $last_name = array_pop( $full_name );
            // ensure we actually found a last name
            if ( $last_name )  {
                // cut the first letter out for our index
                $index = substr( $last_name, 0, 1 );
                // set up a new empty array overwriting the old indices
                $index_letters = array( $index );
        // return the indices item's indices
        return $index_letters;

    Can you please help me?

    I’m using this code in another index on the site. I need to remove the first two words in the title so that the sorting is done by the third word. Something like this:


    I do not want all articles to appear in X, but depending on A, B, C I want titles to appear in letter A, B, C.

    The above code works for this need but it seems that it disturbs the diacritics in the title.

    Plugin Author Daniel Llewellyn


    You could try replacing substr() with mb_substr(), which requires that your PHP installation has the multibyte string (mbstring) extension enabled. You did indicate that it is enabled, but I just wanted to double check that..

    Thank you! It works like a charm!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.