Tagged: portfolio grid
Hi!
I have added a date custom field to the portfolio item and I’d like to add that attribute to the “order by” option on the portfolio grid. Can you point me in the right directions?
Was looking to other support request and found this link in a few of them: http://kriesi.at/documentation/enfold/how-to-add-an-orderorderby-option-to-the-blogpost-sliderportfoliomasonry-grid-element/. But the link redirects to a different section of the documentation now.
Thanks
Hey koen_dieren,
Yes, that is the updated documentation :)
If you do scroll there, you can see all the details!
Let us know if that will work for you.
Best regards,
Basilis
Does not work mate.
That links to documentation about contact forms not about “order by” options for the portfolio grid.
Hi,
Please add this code to the functions.php file.
//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'] = 'date';
$query['order'] = 'DESC';
return $query;
}
and adjust the value(s).
https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Best regards,
Peter
Hi Dude,
Not working for me, can you check the function or have a look in the backend?
Hi,
The “order” and “orderby” settings are already available in the Portfolio Grid panel. Just scroll at the very bottom of the element’s panel. Do you need to sort your portfolio items based on the custom field? Try to use the “avia_post_grid_query” filter to adjust the “orderby” parameter. It should be set to “meta_value”.
// https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Best regards,
Ismael