Login

To vote or comment, enter your email and we'll send a magic link

3

Add ascending/descending sort order

open

I would like to be able to switch between ascending and descending sort order in facets. The current "sort by" options are hardcoded. For instance, I would like to use fSelect & sort by descending term order (instead of the current default which is ascending).

2 years ago

Comments (4)

You can make forms in php template files with the set ($order = 'DESC') you like. Hopefully more details will be added here: https://facetwp.com/help-center/facets/facet-types/sort/

2 years ago

@Aron - it's fairly uncommon for facet choices to need to display in descending order, which is why that setting is omitted.

The main exception is sorting by result count (which FacetWP automatically sorts DESC).

Could you give me an example of your taxonomy so I can get a better idea of why it needs to be in descending order?

Thanks

2 years ago

Hi Matt, in my use case we have a filtering option ”Published in” where the default sort shows earliest date at the top. Most people use the latest issues for filtering. See https://utstallningskritik.se/arkivet & the facet ”Publicerad i” (the site is in Swedish)

2 years ago

The Help Center now contains a new section on how to switch the ASC/DESC order: https://facetwp.com/help-center/developers/hooks/querying-hooks/facetwp_facet_orderby/#switch-the-default-asc-desc-order

9 months ago