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

    (@diddledani)

    Hi,

    You can easily add additional characters to the index, such as numbers, by hooking the filter called a-z-listing-alphabet which lists every character class separated by commas ,. You just need to add the additional characters to the end to include numbers last in your index page:

    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';
    }

    You could also combine all numbers together, while keeping other unknown characters separated by returning something along the lines of:

    return $alphabet . ',#1234567890';

    That will case all numbers to be listed under the heading of #. If you do this you will probably want to hook the filter a-z-listing-non-alpha-char to replace the default non-alphabetic heading which defaults to also be #:

    add_filter( 'a-z-listing-non-alpha-char', function() { return 'Non-alphanumeric'; }

    I don’t get this, please help

    Hi,

    I have the same problem, some posts begins with a number and are not listed in the index.

    i added this code in my function.php

    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';
    }

    but it doesn’t work.

    what code should i use ? and in which file(s) ?

    Plugin Author Dani Llewellyn

    (@diddledani)

    Sorry, I made a mistake in my examples.. The hyphens in the filter name a-z-listing-alphabet need to be underscores:

    add_filter( 'a_z_listing_alphabet', 'your_alphabet_filter' );

    I’m working on updating the plugin to allow both formats so that it doesn’t matter, but until then you need _s.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add numbers to the listing’ is closed to new replies.