• Resolved lentini84

    (@lentini84)


    hi

    hi, i have a question about sorting names in the place marked in red. I would like it to show me the names alphabetically and instead it shows me by ID. Can anything be done here? Thank you in advance for your help.

    https://ibb.co/JcnMGFx

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Contributor Savvas

    (@savvasha)

    Hi there @lentini84 ,

    The link to your screenshot is not working for some reason. Can you try a different service like snipboard.io ?

    Thanks,
    Savvas

    Thread Starter lentini84

    (@lentini84)

    Plugin Contributor Savvas

    (@savvasha)

    What setting do you have at SportsPress->Settings->Events->Players? https://snipboard.io/UFLVcI.jpg

    Thanks,
    Savvas

    Thread Starter lentini84

    (@lentini84)

    yes, yes – I set it here to NAME, because I saw that someone asked for something similar and you prompted him this way. But for me, no matter which option I choose – no effect. It keeps sorting by ID, not last name…

    Plugin Contributor Savvas

    (@savvasha)

    You are right. Please try to add the following code at your childs theme function.php file:

    function wp123_players_selector_args( $args ) {
    	$args['orderby'] = 'name';
    	$args['order'] = 'ASC';
        
    	return $args;
    }
    add_filter( 'sportspress_players_selector_args', 'wp123_players_selector_args' );
    Thread Starter lentini84

    (@lentini84)

    hmm

    i have error “syntax error, unexpected ‘return’ (T_RETURN)”. This applies to: return $args;

    Plugin Contributor Savvas

    (@savvasha)

    Check that you didnt forget any bracket { or }
    The above code is working just fine in my test environment.

    Thread Starter lentini84

    (@lentini84)

    Plugin Contributor Savvas

    (@savvasha)

    On line 192 and 193 you are having some “strange” characters [ instead of [

    Thread Starter lentini84

    (@lentini84)

    that’s weird, i copied exactly what you sent me. But actually – I fixed it and it works! Thank you very much!

    Can I have one more question but related to the table? I mean, is it possible to mark places in each table SEPARATELY in each table? Because at this point I added in the code to highlight places 1-4 in gray. But I would like to add a highlight for each table SEPARATELY! So that in GROUP A it would highlight, for example, places 1-2, and in group B places 1-3. Is it possible?

    https://snipboard.io/azqOyQ.jpg

    Plugin Contributor Savvas

    (@savvasha)

    Please open a new topic for the highlight issue. It will be easier for users with similar questions to seek for support.

    I am marking this one as resolved πŸ™‚

    Thanks,
    Savvas

    Thread Starter lentini84

    (@lentini84)

    ok πŸ™‚

    Thread Starter lentini84

    (@lentini84)

    Savvas,

    I’m sorry but I have one more question related to this list of players. Because it actually sorts correctly, but I have a problem with players whose name begins with Ł. This is a letter that occurs only in Polish. What’s strange – in theory it should sort by last name, but in this case the system gives all players whose name starts with Ł at the very end. You can verify it here: https://laczynasdart.pl/zawodnicy-nld/

    In Polish, Ł is between L and M.

    Thread Starter lentini84

    (@lentini84)

    ok, now i know why. Because it sorts by first name instead of last name. Can this be changed to sort by last name?

    Plugin Contributor Savvas

    (@savvasha)

    I am afraid that this is not possible. If you check at a Player’s Edit Page you can see that there is only a Name field. If you select the sortby name option then there is no way to differentiate between first-name and last-name/surname.

    Instead of writing First-name Last-name you can write Last-name First-Name as the name of your player. Then the sorting will be as you want πŸ™‚

    Thanks,
    Savvas

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘sorting by name’ is closed to new replies.