Skip Navigation

[Resolved] Always sort by 'Random'

This support ticket is created 4 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 3 replies, has 3 voices.

Last updated by Jamal 4 years, 1 month ago.

Assisted by: Jamal.

Author
Posts
#1805955

Hi Toolset

Site URL: hidden link

On this project, the client ALWAYS wants the results soted by 'random'. Therefore we don't really need a sort filter.

So, is there a way of coding this functionality directly into the main Toolset system (Function.php file?), and then we can ditch the Sorting Filter from the Content template?

Kind regards
Ade

#1805983

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2020-10-09 at 15.16.15.png

This is a View made with Blocks, yes?

Rather than add a front-end sorting control, you can just set the order required in the settings for the View.

Be sure to select the View block (use the block navigation at the top of the page if required) and then you should find the sorting options in the sidebar (see screenshot).

And don't forget to delete the front-end sorting control from the View.

#1806057

Hi Nigel

Thanks for the very quick response and that was so easy 😃

I couldn't find a 'simple' way to remove the front-end sorting from the View, so I just went into code view and removed this section:

<!-- wp:toolset-views/sorting {"fields":[{"value":"rand","label":"Random order","flabel":"Random order","asc_label":"Ascending","desc_label":"Descending"},{"value":"post_title","default_direction":"ASC","flabel":"Post title","asc_label":"A to Z","desc_label":"Z to A"}],"forceApply":"ajax","includeLabel":false,"label":"Sort by","orderbyPreviewSelected":"rand","orderbySelectStyles":{"margin":{"enabled":true,"marginLeft":"15px"},"padding":{"enabled":true}},"orderbySelectCSS":"margin-left: 15px; ","style":{"blockAlign":"right"}} -->
<div class="wp-block-toolset-views-sorting wpv-sorting-block"></div>
<!-- /wp:toolset-views/sorting -->

I assume that was OK to do? Seems to be working correctly.

Kind regards
Ade

PS: Very stupid question, but how do you add your photo profile? I have been hunting everywhere and can't find an option to upload a picture.

#1806243

Hello Ade,

Removing the code should be fine.

Regarding your last question, we are actually using the Gravatar service for the profile images. If you want to upload the profile images to your site, you will need to install a 3rd party plugin such as the following:
- https://wordpress.org/plugins/simple-local-avatars/
- https://wordpress.org/plugins/metronet-profile-picture/

If the original issue of this ticket is handled, please mark it as resolved and open a new ticket for any other question/request.