Hey, I'm looking for a good way to take the grid view of a directory form entry and get it to show random entries from the form. I think I can do it with this code snippet example, but... I don't know how to tell it to give me a random ordering. I get the ascending and descending part, but how do I tell it to sort randomly? I'm also wanting this to resort when the page reloads, if that saves a question. I was assuming the random in itself would shuffle automatically on a page load.
add_filter('frm_view_order', 'change_view_order', 10, 2); function change_view_order($query, $args){ if ( $args['display']->ID == 2412 ) { //replace 2412 with you Field ID $query['order'] = 'ORDER BY MONTH(it.created_at) ASC'; } return $query; }
Example here: https://development.fdmdigital.co.uk/demo-view-page/
That's exactly what I was looking for. I'm a bit surprised their support didn't start there instead of web hooks...
Thanks. I never would have looked under the left drop down... kept trying to figure out why it wasn't an option on the right side drop down.
Please login or Register to submit your answer