Is it possible to add a filter to sort the portfolio grid by menu order?
I tried the following and it did not work
/* Changes portfolio grip to sort by menu */
add_filter( ‘avia_portfolio_grid_query’, ‘avia_portfolio_grid_query’, 10, 2);
function avia_portfolio_grid_query( $query, $params ) {
$query[‘orderby’] = ‘title’;
$query[‘order’] = ‘ASC’;
return $query;
}
Hi Arron!
I tested this code locally, it worked:
function custom_post_grid_query( $query, $params ) {
$query['orderby'] = 'title';
$query['order'] = 'ASC';
return $query;
}
Remember that it will take the Title, not the slug.
If it doesn’t work please provide us with an administrator account so we can take a look.
Best regards,
Josue
Thanks so what would the add filter look like?
add_filter( ‘avia_portfolio_grid_query’, ‘custom_post_grid_query’, 10, 2);
Hey!
You can use this:
add_filter('avia_post_grid_query', 'avf_custom_post_grid_query');
function avf_custom_post_grid_query ( $query ) {
$query['orderby'] = 'rand';
return $query;
}
Best regards,
Ismael
That worked…thanks…great support