Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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

    #1317250

    Hey 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,
    Ismael

    #1317320

    Hello Ismael. Here are the login credentials.
    Thanks a lot.

    Bertrand

    #1317453

    Hi,

    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,
    Ismael

    #1317509

    Sorry, I must have made a mistake in the password. Here is a new one. Thanks for your help.

    #1317870

    Hi,

    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,
    Ismael

    #1317990

    Hello 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

    #1318222

    Hi,

    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,
    Ismael

    #1318290

    Many Thanks Ismael.

    #1318875

    Hi,

    No problem. Please feel free to open a different thread if you need anything else.

    Have a nice day.

    Best regards,
    Ismael

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Portfolio random – cache GetFlywheel & WP Rocket’ is closed to new replies.