Tagged: categories, feature, Portfolio
We would like to set a custom order for the filtering categories in the porfolio grid. Right now it’s always alphabetical.
Could you add a filter so the order can be changed?
Hey appixag,
Thank you for the inquiry.
This is possible but you have to modify the enfold/config-templatebuilder/avia-shortcodes/portfolio/portfolio.php directly. Look for this code around line 1159.
//get all categories that are actually listed on the page
$categories = get_categories( array(
'taxonomy' => $params['taxonomy'],
'hide_empty' => 0
) );
The get_categories function accepts more arguments including a parameter to change the order of the terms or categories.
// https://developer.wordpress.org/reference/classes/wp_term_query/__construct/
Best regards,
Ismael
Hi Ismael
Thanks for the response.
Is there any way to do it without editing the theme files, e.g. in a child theme? I assume these changes would get overwritten with each Enfold update.
I thought you could just add a new filter so we could either edit the $categories
array or the argument for get_categories
but I’m no WordPress expert.
Thanks.
Hi,
You can refer to this post – https://kriesi.at/documentation/enfold/intro-to-layout-builder/#add-elements-to-alb and apply the changes on your child theme.
Best regards,
Yigit