Skip Navigation

[Resolved] How to order a view with categories ?

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to order their category on a custom sort order that doesn't have any specific order such as Alphabetically.

Solution:

My recommendation was that the user create a custom field to define their custom sort criteria.

Then in that field you would put 1,2,3,4 etc to help set the order.

Then on views you can sort the terms by this field. Currently i'm not sure what order those taxonomy is in.

This support ticket is created 5 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by puneetS-3 5 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1329431

I have a view with the content selection of "product categories", and I have written some custom code to show some data in it on the frontend. Now I want it to order in arbitary way. How can I acheive that?

You can see the content by following the link. It's the second section, just after the hero section.
hidden link

In some documentation I found that they have advised to use this (https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query). I am unable to understand the usage. Please help.

#1329459

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2019-09-02 at 9.57.44 AM.png

Hi Puneet,

Thank you for getting in touch.

Actually on the ordering settings for your view there should be an option for a "no order" sort order. If you go to your view and edit it. You should see this option See Screenshot.

Please try this and let me know.

Thanks,
Shane

#1329563

I did change this setting. How would it help me change the order arbitaraly ?

#1329693

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Puneet,

I'm assuming when you say sort Arbitrarily you mean to sort it randomly.

If you set this to no sort order. It should display the posts in a random fashion.

Thanks,
Shane

#1329827

No, I have a order which I would like to force in the frontend. Is it possible?

#1330485

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Puneet,

What is the order that you wish to sort them by?

Please let me know.

Thanks,
Shane

#1330493

I want to sort them by the following order:

Dwarka
Rohini
South Delhi
Gurugram
East Delhi
Noida
West Delhi
North Delhi
Ghaziabad
Faridabad

The one on the top should be the first and so on.

#1330509

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Puneet,

It seems like a manual order.

If there are no specific attributes to order the terms by I would suggest that you create a custom field for the terms, a numeric field called Order.

Then in that field you would put 1,2,3,4 etc to help set the order. Then on views you can sort the terms by this field. Currently i'm not sure what order those taxonomy is in.

Even if we were to use some custom code we would still need an attribute to sort the terms by.

Thanks,
Shane

#1331197

Hey this was too easy, thanks it worked.