-
AuthorPosts
-
August 17, 2021 at 6:08 am #1317070
On the website https://www.asian.estate/ I use portfolios to present the properties, as for example on this page : https://www.asian.estate/thailand/bangkok/properties-by-prices/
The site is hosted on Flywheel and I also use WP Rocket for the cache management…
I would like on the portfolio, to show the properties in “random” so that they are displayed randomly. But it doesn’t work.
I think it comes from the caching of the pages. I have however, on this page, unchecked the caching by WP Rocket.
I also added the code, in Enfold Child (read on the post https://kriesi.at/support/topic/random-post-sorting-not-working/#post-704945)
//portfolio query
add_filter( ‘avia_post_grid_query’, ‘avia_post_grid_query_mod’, 10, 2);
function avia_post_grid_query_mod( $query, $params ) {
$query[‘orderby’] = ‘rand’;
return $query;
}But it still doesn’t work when I reload the page Chrome, Firefox…
Is there a solution?
Thanks in advance
Bertrand
August 18, 2021 at 6:04 am #1317250Hey Bertrand,
Thank you for the inquiry.
The filter above should have worked. Please post the login details in the private field so that we could check the issue properly.
Best regards,
IsmaelAugust 18, 2021 at 11:33 am #1317320Hello Ismael. Here are the login credentials.
Thanks a lot.Bertrand
August 19, 2021 at 10:00 am #1317453Hi,
We tried to login to the site but the account info above seems to be invalid. Please check the info carefully or provide another account.
Best regards,
IsmaelAugust 19, 2021 at 3:06 pm #1317509Sorry, I must have made a mistake in the password. Here is a new one. Thanks for your help.
August 23, 2021 at 4:48 am #1317870Hi,
Thank you for the update.
The filter works fine when we deactivate the Category Order and Taxonomy Terms Order plugin. The plugin probably changes the posts query and overrides the filter.
Best regards,
IsmaelAugust 23, 2021 at 3:33 pm #1317990Hello Ismael.
Thank you for your reply. However, it is annoying now, because the categories are no longer sorted in order. Is there another plugin that can do this without query conflicts?
Or is there a solution for sorting with a filter?
Thank you in advance for your answer.
Best regards
Bertrand
August 25, 2021 at 6:33 am #1318222Hi,
You can manually edit taxonomy or category query within the sort_buttons function in the enfold\config-templatebuilder\avia-shortcodes\portfolio\portfolio.php file but this will get applied on all sort buttons in every portfolio grid element. You have to adjust the order and orderby parameter.
//get all categories that are actually listed on the page $categories = get_categories( array( 'taxonomy' => $params['taxonomy'], 'hide_empty' => 0 ) );
// https://developer.wordpress.org/reference/functions/get_terms/
Have you tried using this plugin instead? We have not tested it, so we are not sure if it will work without interfering with the query filter.
// https://wordpress.org/plugins/custom-taxonomy-order-ne/
Best regards,
IsmaelAugust 25, 2021 at 1:53 pm #1318290Many Thanks Ismael.
August 30, 2021 at 3:58 am #1318875 -
AuthorPosts
- The topic ‘Portfolio random – cache GetFlywheel & WP Rocket’ is closed to new replies.