Posted: February 13, 2015 at 8:04 am
Hi, quick question, on the category selector for the list view template how can I change the order of those categories? (client request…) http://screencast.com/t/pwvjqgzPxqw4 |
|
|
It’s in line 24 of plugins/ee4-events-table-template/templates/espresso-events-table-template.template.php. You’ll want to copy that to uploads/espresso/templates first before you modify it. |
note that I have a different template that loads which was suggested here: https://eventespresso.com/topic/list-view-template-shows-register-for-events-that-have-no-registration/ Can you give me a bit more information about how to correct the category order, thanks very much |
|
|
Oh, yeah, you see on line 25 of Dean’s gist file? That’s where it’s getting the categories. And then line 27 is where it’s looping over the array of categories. You would want to go in between those lines and rearrange the order of the categories. How did you want them arranged? You might want to throw some debugging code in there like this: https://gist.github.com/sidharrell/54c9cf75f6328f35c4b3 to take a look at the category objects that are retrieved, so you’ll know what you have to work with as far as criteria for resorting the array. |
Is there no easier way to modify these categories? The client doesn’t like the order they appear in the drop down and modifying this code is a little out of my scope. |
|
How do you want to order the categories? Then are currently ordered by category name in ascending order. |
|
the client wants to be able to choose based on what they consider more important or which are more frequent e.g. they want ‘Process’ first then the Information events then the others. But it depends on how hard this is to achieve. |
|
|
Hi, Changing the order is going to need a code change regardless. By default it spits out the categories in name (A-Z) order. Changing the order to something like Z-A or by category ID (e.g. 1-10 or 10-1) would not require that much coding, simply just by changing the $args array a little bit. (http://codex.wordpress.org/Function_Reference/get_terms) If your client needs something more than that, such as a specific order, then the coding becomes more challenging, especially if they are planning on adding/changing/deleting categories in the future. It can still be done, but would require code specific to your use case. |
The support post ‘changing the category order on the drop down selector for the grid view template’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.