This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Questions Regarding Advanced Title Fields

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Questions Regarding Advanced Title Fields Reply To: Questions Regarding Advanced Title Fields

#20298
Michael SamsonMichael Samson
Participant

Hi Ernest,

I appreciate that you tried to do this via server-side mobile detection, but this is not the best solution for my needs. Let me explain why…

The main issue with this method is exactly what you were talking about above, the difficulty of detecting mobile devices server-side. This solution must be extremely consistent in order for us to use it. It would have to work perfectly in all situations, which cannot be guaranteed via a method like this.

The other more pertinent reason is that this is not really a “mobile” issue. It is a sizing issue related to screen sizes and search result card proportions. As you know the plugin automatically determines the size and number of cards based upon the available screen space. This means that there are several popular screen sizes that will have cards that are too small (and would require the lower word count), but are not considered mobile devices. Some examples of this are the 768px width (iPad), 600px width, and 480px width. All of these sizes will not accommodate the 20 word count that I want to use for the larger screens.

This is why when I first wrote to you about this that I was speaking about a cut-off point at 768px, because I already worked out the math and knew this is where the lower word count would need to begin. We cannot base this upon mobile detection. It must instead be based upon screen size (viewport), just as we do with css media queries. This way we can be absolutely sure of when the lower word count will be used, and define this to a specific cut-off point that works best.

If you are willing to try this, this is the approach that would work…

We would need two new settings. The first would be a cut-off point in pixel width (max-width) that the lower word count would apply to. We would set this to 768px, and that would mean the lower word count would apply to all devices with a width of 768px and lower. Any screen widths above 768px would use the higher word count. The second setting would be the lower word count itself, where we would define the maximum number of words to be used on the smaller screens.

Beyond the reasons I described above, the other reason this will work better is it will not be dependent upon server-side detection. Instead it will use client-side detection just like css media queries. This will work every single time no matter what kind of device the user is using. It is also more flexible because we can define the cut-off point, and not worry about what devices are considered “mobile.”

I know I’ve asked a lot of you here, but if you can go this one last step it would be exactly what I need to make this work. I also think this is a better approach for anyone else that makes use of this filter.

~ Michael