This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Ordering result by custom field

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Ordering result by custom field

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #53676
    YansYans
    Participant

    Hi,

    We use ASP to list and filter projects on https://rail-research.europa.eu/rail-projects.

    A project is a CPT that has custom fields, all implemented with ACF Pro.

    We have a custom field called project_type which is a select list with the options:

    1 : Flagship
    2 : Exploratory research

    We want to display the projects ordered by project_type with “Flagship” projects first.

    In the index we configured ordering (Search sources > Ordering):
    Primary ordering = Custom Field ascending
    Field name = project_type
    Field type = numeric

    But, when we access https://rail-research.europa.eu/rail-projects it is ordered by the default publication date.

    We tried also:
    Primary ordering = Custom Field descending
    Field name = project_type
    Field type = string or date

    But it didn’t work.

    However, when refreshing the page the projects are ordered according to project type like we want.

    How can we have the order we want on the initial page load?

    Thanks.

    PS
    Unfortunately we cannot give you access to the backend, we don’t have permission from our client.

    #53677
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Thank you for the details!

    I think the issue might be the auto-populate setting, you seem to have set it to display the latest results, which overrides the primary ordering for the initial results.

    Can you please try this setup instead: https://i.imgur.com/u32EyJS.png

    It will do the trick.

    #53682
    YansYans
    Participant

    Thanks!

    I confirm the problem is fixed.

    You can close this ticket.

    #53683
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Ordering result by custom field’ is closed to new replies.