-
AuthorPosts
-
November 12, 2013 at 11:32 pm #187528
Hi there.
I am looking to change the order of portfolio categories. I currently have All / Fall / Summer / Winter. I assume the default is alphabetical. I need to change the order so that it is seasonal. All / Summer / Fall / Winter.Is this possible? Does it have to do with the Slugs??
Not sure where to look.Cheers.
BradNovember 13, 2013 at 4:42 am #187615Hi Brad!
Edit config-templatebuilder > avia-shortcodes > portfolio.php, find this code on line 410:
//get all categories that are actually listed on the page $categories = get_categories(array( 'taxonomy' => $params['taxonomy'], 'hide_empty'=> 0 ));
Replace it with:
//get all categories that are actually listed on the page $categories = get_categories(array( 'taxonomy' => $params['taxonomy'], 'hide_empty'=> 0, 'orderby' => 'name', 'order' => 'DESC' ));
Remove browser cache then reload the page. Refer to this link for more order parameters: http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Cheers!
IsmaelNovember 13, 2013 at 8:23 am #187642Hi Ismael.
Thanks for getting back to me so quickly. I switched up the code as you suggested. I can change the order but, it is not pulling in via the Slugs still. I cheated the names of the Slugs and tried ID instead of Name. No luck.
Any other sneaky tricks you might be able to help me with?
Cheers.
BradNovember 13, 2013 at 8:25 pm #187954HI Ismael. A follow up to my reply from last night. As I mentioned, your code allows me to change the order from ASC to DESC. Unfortunately it is still only pulling in the Sort Buttons by alphabetical and not by the Slug titles. I have tried a bunch of alternatives around the ‘orderby’ – ‘name’, but nothing is working.
Any help would be great.
Cheers
BradNovember 14, 2013 at 3:23 am #188170Hey!
I’m not sure if that is possible. Have you tried the “ID” parameter? You need to create the categories according to the order that you want. Click on Portfolio Item > Portfolio Categories then create the categories again. You’ll see the “ID” if you edit the category then look for the URL, it looks like this: http://localhost/kriesi/enfold/wp-admin/edit-tags.php?action=edit&taxonomy=portfolio_entries&tag_ID=22&post_type=portfolio
The ‘ID’ of the category on the example above is “22”.
Cheers!
IsmaelNovember 14, 2013 at 6:08 am #188225You’re a genius!
It only worked when I rebuilt the categories to get sequential ID’s. In the future, is there a way to change the ID #’s other than rebuilding the categories? Currently I have Summer #74, Fall #73, Winter #72, which gives me the order I want. What if I want to make it #73, #74, #72?
I tried the code as ‘orderby’ => ‘ID’,
‘order’ =>’73’, ’74’, ’72’,And didn’t have any luck.
At least it is working now!Thanks again.
Brad -
AuthorPosts
- The topic ‘Control Order of Portfolio Categories?’ is closed to new replies.