• Resolved xpurge

    (@xpurge)


    Please help me, i want to add number and symbols to a-z listing but i don’t know how. I don’t get the answer on first topic about adding number to a-z listing

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Dani Llewellyn

    (@diddledani)

    The code examples in the other thread need to be added to your theme (or child theme)’s functions.php file. The code examples in that thread, when added to your functions.php file will tell the plugin what to class as indexable when it appears as the first letter in a title.

    The first block of code shows how to add numbers to the end of your list page when it is built; each number will be a separate category. The return in the function in that first block sends the text after it (in PHP plain text needs to be enclosed in quotes ' or "). The text is expected to be a list of letters separated by commas , where each group contains all the letters that should be listed in that section of the listing. The block there takes the original list that we call $alphabet and adds the extra groups onto the end in the line that begins with return:

    add_filter( 'a-z-listing-alphabet', 'your_alphabet_filter' );
    
    function your_alphaber_filter( $alphabet ) {
        return $alphabet . ',1,2,3,4,5,6,7,8,9,0';
    }

    For reference, the default grouping is similar to Aa,Bb,Cc....Xx,Yy,Zz which will list each alphabet letter separately but groups upper and lowercase letters of the same name together. i.e. A and a need to both be specified because to a computer they are different letters but in language they are the same, so we put them together in the same group. The first letter in each group, remember that the groups are separated by commas ,, is used as the title for that group when shown on the page, i.e. A, B, C, etc.

    So i added this code

    add_filter( 'a-z-listing-alphabet', 'your_alphabet_filter' );
    
    function your_alphaber_filter( $alphabet ) {
        return $alphabet . ',1,2,3,4,5,6,7,8,9,0';
    }

    in my theme’s functions.php
    but nothing happen, still no numbers
    sorry for my english xD

    Plugin Author Dani Llewellyn

    (@diddledani)

    oh, I’m really sorry, I got the name of the filter slightly wrong – I used - in my example but it should be _:

    add_filter( 'a_z_listing_alphabet', 'your_alphabet_filter' );
    
    function your_alphaber_filter( $alphabet ) {
        return $alphabet . ',1,2,3,4,5,6,7,8,9,0';
    }

    @diddledan, yeah it works, i also use this return $alphabet . ',#1234567890';
    but i want this # to be on the first, i mean before the A how can i do that?

    Plugin Author Dani Llewellyn

    (@diddledani)

    Hi, sorry about the delay – I missed the notification that you had replied.

    To get the numbers first in the list, you would rearrange the return line to read similar to:

    return '#1234567890,' . $alphabet;
    
    Plugin Author Dani Llewellyn

    (@diddledani)

    Are you still having issues? Is there any more help I can provide?

    I’m marking this topic resolved for now, but please don’t let that deter you from calling on me for more assistance if you need.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Easiest way to add number on a-z listing’ is closed to new replies.