Skip Navigation

[Resolved] rand result in custom searc

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

Problem:

The user wants to display search results in a random order in a Toolset View without showing the sorting dropdown menu.

Solution:

Set Sorting to Random Order:

1. Add a sorting control to the Toolset View.
2. Set the sorting control to display results in random order.

Hide Sorting Dropdown Menu:

1. Use custom CSS to hide the sorting dropdown menu.

div.wpv-sorting-block {
    display: none;
}

Relevant Documentation:

https://toolset.com/course-lesson/creating-a-view/#add-front-end-sorting-to-a-view

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.

This topic contains 8 replies, has 2 voices.

Last updated by Christopher Amirian 10 months, 1 week ago.

Assisted by: Christopher Amirian.

Author
Posts
#2683817
random.png

Hello
In this view, the first sort is alphabetical, but I'd like to know if it's possible to display the custom search result in a random way.
I can't find rand in the drop-down menu.
Thank you

#2683994

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

The search field item does not have a random order option.

If you want to have a random order option, you can add a sorting control and there inside the control you will have the option for the Random Control.

For more information:

https://toolset.com/course-lesson/creating-a-view/#add-front-end-sorting-to-a-view

#2684074

Hello
Thank you, but is it possible to just activate the random mode without displaying the drop-down menu?

#2684105

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Yes it is possible, please follow the steps mentioned int he documentation that I shared to add the the sorting dropdown and set it to be Random Order which will show by default that.

Then go to your theme options where you can add CSS code and add the code below:

div.wpv-sorting-block {
    display: none;
}

Or alternatively, you can add the code above to style.css file of your theme.

Thanks.

#2684190
Capture d’écran 2024-02-20 065930.jpg

Hi
it doesn't work as expected, if I use the css you suggested the sorting is done with view field sorting and not with rand

#2684195

Christopher Amirian
Supporter

Languages: English (English )

Screenshot 2024-02-20 at 10.12.48.png

Hi there,

On the same sorting control options on the sidebar there is an option at the top to select which order type should be used as default. please set it as random order there too (check the screenshot)

If the issue persists, I'd appreciate it if you can follow the steps below:

1- Set the next reply as private.
2- Give the link to the page that you used the view in the WordPress Dashboard.
3- Tell me where I can check the CSS code that you have added.
4- Give the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.

Thanks.

#2684200

it continues but I don't have the right form to put my information in private

#2684210

Christopher Amirian
Supporter

Languages: English (English )

Would you please try now?

#2684419

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you for the information. Please check this video:

hidden link

I used the same default Sort order option of the sort control to set the order to random and in the video I showed that on each reload it shows a random order of the albums.

Thanks.

#2684425

I hadn't opened or set default order when I tried.
My apologies and thank you very much.