• elmariachi09

    (@elmariachi09)


    Can I change sorting order of matches in “user” page?

    I’d like to see the latest match on the top.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author AntoineH

    (@antoineh)

    Only on the user page? Or everywhere?

    In case of the latter there is an option in the plugin options. In case of the first, you can only change the order via custom code. You’ll need to use the filter footballpool_user_page_matches. And there is a simple helper function in the Football_Pool_Matches class that can sort the array for you, e.g. like this:

    usort( $matches, ['Football_Pool_Matches', 'sort_matches_array_by_date_desc'] );
    Thread Starter elmariachi09

    (@elmariachi09)

    I want it only on user page.

    Where do I have to insert this code?
    Into football-pool/pages/class-football-pool-user-page.php?

    Plugin Author AntoineH

    (@antoineh)

    No, I wouldn’t recommend changing files in the plugin. My advice would be to create an extension plugin that hooks into the mentioned filter and returns the sorted matches.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can I change sorting order of matches in “user” page?’ is closed to new replies.