Custom Sorting not working on Widgets

This topic contains 10 replies, has 4 voices, and was last updated by  Dave 5 years ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #515680

    Dave
    Full Member
    Post count: 205

    Hi guys,

    I’ve set up a ‘Recommended’ in the event sorting options which should put any featured events first, then sorted by highest rating, then by date.

    It seems to work just fine on an archive page like this one:
    https://whatsonhub.co.uk/events/united-kingdom/west-yorkshire/leeds/

    But in the first “top picks” widget on the home page, I’ve set it to ‘recommended’ sort, but it won’t do the same sort order that it’s supposed to (featured, then highest rating)…
    https://whatsonhub.co.uk/city/united-kingdom/west-yorkshire/leeds/

    Can you help?

    Thanks,
    Dave

    #515681

    Dave
    Full Member
    Post count: 205
    This reply has been marked as private.
    #515685

    Guust
    Moderator
    Post count: 29970

    The widget is set for the next 7 days only.
    The events page has all upcoming.
    The featured events are not in the next 7 days.

    Thanks

    #515861

    Dave
    Full Member
    Post count: 205

    Hi Guust,

    Just added a ‘featured’ event that’s on this week. Good news is that’s showing first in the ‘top picks’ widget on the home page.

    However, the event that has the highest rating that’s on this week, isn’t showing next (it’s not showing until page 3).

    Thanks,
    Dave

    #515943

    Guust
    Moderator
    Post count: 29970
    This reply has been marked as private.
    #516004

    Dave
    Full Member
    Post count: 205

    Thanks Guust.

    This event… https://whatsonhub.co.uk/events/united-kingdom/west-yorkshire/leeds/leeds-heritage-beer-tour-5/

    … is the one that should come directly after the featured events. It does on the events archive, just not on the widget, so looks like it’s obeying the top-level sort, just not the second level.

    Thanks,
    Dave

    #516301

    Naveen Giri
    Moderator
    Post count: 1559

    Hi DAVID,

    can you provide any staging link. where we can check by changing data values for events and also FTP details will be helpful.

    Thanks

    #516463

    Dave
    Full Member
    Post count: 205

    Hi Naveen,

    You can play around with this site just fine. It’s not launched properly yet so everything I have is on here. It’s backed up hourly but if you want to take specific backups by all means (login and FTP details are further up this thread).

    You’ll notice too that for some reason, the speed of the site randomly slows down intermittently. I can’t figure out why but when I just managed to find some errors in the console, it was saying it was a GeoDirectory thing. Any chance you can look while you’re there?

    Thanks,
    Dave

    #516710

    Naveen Giri
    Moderator
    Post count: 1559

    I am proceeding on site slowdown issue on other ticket.
    I will assign the widget issue to kiran. he will be quick here.

    #516740

    Kiran
    Moderator
    Post count: 7069

    Hi David,

    On archive page it uses secondary sorting used in CPT > Settings > Sorting but on widget it applys only parent sorting.

    I have added following PHP snippet to apply secondary level sorting to the widget listings.

    
    
    
    /**
     * Add secondary level  sorting to the widget listings.
     */
    function gd_snippet_191112_filter_widget_listings_orderby( $orderby, $table, $post_type ) {
    	global  $gd_query_args_widgets;
    
    	$sort_by = ! empty( $gd_query_args_widgets['order_by'] ) ? $gd_query_args_widgets['order_by'] : '';
    	$orderby = GeoDir_Query::sort_by_children( $orderby, $sort_by, $post_type );
    
    	return $orderby;
    }
    add_filter( 'geodir_filter_widget_listings_orderby', 'gd_snippet_191112_filter_widget_listings_orderby', 0, 3 );

    Please check and let us know.

    Regards,
    Kiran

    #516793

    Dave
    Full Member
    Post count: 205

    Ok great, thanks Kiran. I’ll take a look.

Viewing 11 posts - 1 through 11 (of 11 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount