I would like to randomize the order that the portfolio items appear each time the page is loaded. At the moment the order is defined by when the portfolio page was created, and although you can adjust the date and time to move them up and down the order (very slow and annoying) the is no way to have the portfolio items randomized.
Hi
I would like to randomize the order that the portfolio items appear each time the page is loaded. At the moment the order is defined by when the portfolio page was created, and although you can adjust the date and time to move them up and down the order (very slow and annoying) the is no way to have the portfolio items randomized.
can you help?
Hello Gareth, I see that tis a good idea but this is custom work
The trick is to use orderby parameter as rand in wp-query which fetches the portfolio items
https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
so for example if you are using a contain slider
you need to go to gallery-contain-page.php page template and modify
$legrand_tax_query = array(
array(
'taxonomy' => 'portfolio_category',
'field' => 'slug',
'terms' => $legrand_category_filter,
orderby => 'rand'
),
);
Once again I like the idea we may include it in feature updates.
thanks
Thank you.
Clapat Support
Review Envato Item Support Policy
Follow us!
https://www.clapat.com/
https://www.facebook.com/clapat.ro
https://www.instagram.com/clapat.themes/
https://x.com/clapatdesign
https://www.linkedin.com/company/clapatstudio
https://www.tiktok.com/@clapatstudio
Hi
I have adjusted the gallery-contain-page.php page(see attached) but no luck. Have i done it correctly?
No, my mistake
'orderby' => 'rand'
forgot the quotas
Thank you.
Clapat Support
Review Envato Item Support Policy
Follow us!
https://www.clapat.com/
https://www.facebook.com/clapat.ro
https://www.instagram.com/clapat.themes/
https://x.com/clapatdesign
https://www.linkedin.com/company/clapatstudio
https://www.tiktok.com/@clapatstudio