Quite handy, but customization is less straightforward. The support team behind it are extremely reluctant to help, especially when questions regarding customizations are asked, even though they can be very simple to answer.
One of the things I came across, is that ordering the items has limitations. Within the theme options (Item/Category Location Options), you can select to display 5, 10 or 20 results at the same time, and order them by Title or Date, ASC or DESC. These are severe limitations in my opinion.
– 5, 10 or 20 items is not only a very small amount, I generally prefer numbers that can be divided by 2, 3 and 4, so I can allow display of items to be trimmed to 1, 2, 3 or 4 columns, depending on the screen size.
– Sort by Title or Date is not always the desired solution. In my instance, I needed to list privately owned holiday houses for rent. By having the same order each time, some houses are always at the front, some always at the back. I was looking for equal exposure for all of them: random sorting. Different order each time someone visits the website.
Apparently, I am not the only one with this issue. I searched for solutions, and came across several Directory+ buyers, both on the AIT website and the Code Canyon website, where the theme is also sold. Without exception, the possibility is simply denied and questions on how to add this functionality are ignored.
I dug into the code, and found out that the answer is very simple! I’m posting it here, so hopefully others do not have to wonder anymore, and can add this simple piece of great functionality!
How does it work?
– All you need to do is make some changes to the file “@theme.neon”. It is located in the directory2\ait-theme\config folder.
– to change the number of items shown per page, go to the SortingDefaultCount block at line 680, as shown below. By default, the numbers are only 5,10,20. But you can simply add other numbers of your preference. These are then added in the Theme options and can be selected.
sortingDefaultCount:
label: Number of Items
type: select
selected: 5
default: [5, 10, 20, 24, 36, 48, 60]
help: "Number of items listed on one page"
– to add the random sort option, in the same @theme.neon file, go to the SortingDefaultOrderBy block at line 686, as shown below. By default, only “date: Date” and “title: Title” are there. Simply add the line “random: Random”. Once saved, the “Random” options appears in the Theme Options
sortingDefaultOrderBy:
label: Order By
type: select
selected: date
default:
date: Date
title: Title
random: Random
help: "Select order of items listed on page"
This post was last modified on 28/06/2018 09:23
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Building your WordPress website efficiently using the 10 tips I documented after years of experience.…
View Comments
Do you know how to get this code to work on the frontend as well?
I added your code to the file and it works great in the backend dashboard/theme options area but I'd love to be able to offer these options to the website viewers/visitors.
Oh and I found the ait facebook group. Thanks for that tip.
Hi Lane,
sorry, no idea. I would really have to dig in the code, but have no time for that. Perhaps someone in the FB user group already knows this?
Some months later …
We had a somewhat general discussion about AIT Themes in March, Boris. Things didn't change since then: I still wish there was a user forum where AIT Directory Theme user could exchange problems, solutions and ideas. We should set one up.
Overall the AIT Directory themes are pretty good — but e. g. running into the issue of the locked header maps (one has to unlock the front end map for scrolling each time a page is loaded) I had to open a support ticket.
A user forum would help in such cases (I am sure many had the same issue before) or a good documentation. Both are not provided by AIT Themes.
Are you still using AIT themes?
Cheers, Frank
Hi Frank,
yes, I'm still using AIT themes. I set up this website for one of my clients. They do not have the budget to start over with a new theme, if there even is any that would suit this purpose.
It's working okay, and after every update I make the manual changes to some of the theme files again, but it works.
Support has not been bad, I've had one or two minor issues to which they replied within a couple of hours.
So in all, it's not bad. But I agree with you that a forum and extensive documentation would be a great benefit.
Thanks for your answer, Boris.
What do you think: Should we create a AIT Themes Usergroup? I would be willing to share my experience in a protected environment (members only).
Cheers, Frank
Hi Frank,
I suppose we could, there might be more of us out there looking for AIT-answers :-). What did you have in mind? A LinkedIn group or on some other platform?
Thanks for responding.
What's the link to the facebook group you mentioned?
Can you email it to me just in case I don't get back here for awhile.
HI Lane,, sure, here is the link to the Facebook Ait Themes User Group.
I'd like to take part in receiving/giving help in a ait user group.
Have you guys set this up yet?
Hi Lane,
Frank actually had plans to set up a website for this purpose. But a short while ago, AIT created a Facebook group for this purpose. Not our ideal solution (crappy search options), but we felt it was not worth the effort anymore, since there is now a FB group. If we ever do pick up the plan again, we'll be sure to contact you!
Regards,
Boris
You got mail, Boris.
No, not Linkedin or other platforms that require a membership in another group.
I think we should setup a site using an AIT theme (Directory or Multi-Author Blog) and integrate a classical forum.
Hi Boris,
thanks your ideas. I like the concept of sharing thoughts and knowledge on such a basis — although AIT support helps out I also wish things would be a bit smoother (and the documentation would be better) …
I think I will try what you propose in a few days when my Directory+ website will be ready and have more content. For now I wanted to ask if your solution could be used with a child theme.
If not the changes would be overwritten with the next Directory+ update.
Any ideas?
Cheers, Frank
Hi Frank,
you are absolutely right. In fact, I did create a child theme for Directory+ for that reason. It's been working just fine.
How do I access the directory2 folder?
Hi Evan,
you can do that via FTP. Access the folder, and edit the files with a HTML or text editor. I recommend Sublime Text, but there are other good ones as well. Good luck!
Thanks for your swift response. Is there a way to do this from the wp editor? I don't even see the @theme.neon file. I see a @theme.php.
I'm not sure if that is the same file, I do not see it in my theme. It's likely that the .neon files are somehow accumulated to PHP files automatically in the theme upon changing. But I cannot check within the default WordPress Editor, as I always disable it so my clients cannot accidentally remove things that shouldn't be removed :-).
Is there no way you can get FTP access? Perhaps you are able to log on to the hosting account? Usually that also includes a File Explorer with which you can leaf through the theme and download the necessary files.
If you do a subsequent search (that would also work if you copy the contents of @theme.php to for instance notepad in Windows), you can check whether the piece of code I'm referring to is in the file. If so, odds are that changing that file will do the trick.
Does that help you further along?
I fixed it. Had to change "random: Random" to "rand: Random"
Thank you so much for your help!
Glad you got it working, you're welcome!
Yes, I was able to access theme.neon through cPanel. I've added the random dropdown selection, now I just need the items to randomize differently on each load. Any thoughts on how to do that? as of right now they are shuffled the same way each time.
I've also experienced what you describe, and found out that it has to do with caching. You can check by doing a search from a different machine in your network, or if that doesn't work, a machine on a different network (so you have a different public IP address). I bet you will get a different order then.
Hi Boris, we are trying to modify the order of the search results in ait-directory2, by a custom postmeta value, but we do not have any idea of how to do that, do you have any suggestion?
Thanks.
Hi Francisco,
can you explain more? Your description is too vague for me to be able to help you.
Hi, we added a postmeta key to every item created, I want to order the search results using the values of that meta key, we do not know if that is even possible, what do you think?, thanks a lot for your answers, we love you lol.
That would require some custom coding, I have no idea what that should look like. I know support at AIT will tell you to hire a developer.
Perhaps if you explain which end result you are trying to accomplish, instead of the technical way to get there (i.e. using a custom meta key), I can help you solve the puzzle.
Good Day Boris
Does this still work?
I have tested these settings and it is not working with our version of AIT Directory+
Hi Andre,
i just updated to the latest version (2.36), and it still works. I did get a 404 error after updating, but that disappeared after resaving permalinks settings and clearing the cache. Can you explain where exactly things are going wrong?