As there seems to be no UI way of defining the sort order of CET elements in the Avia Layout Builder tab (a simple sort order field on the Customize pane would probably do the trick) and elements display in the order they were created by default – is there a filter or array I can use to define this?
I know you can sort aphabetically/by use – but I want to define a logical display order for custom elements I create (and be able to edit this as new elements are added).
Many Thanks
Hey M1000000,
Sorry for the late reply – but I was tagged for this topic today.
At the moment there is no way out of the box.
If you add to your functions.php file (in child theme):
add_theme_support( 'show_advanced_custom_element_options' );
in theme options – Custom Element tab you find a checkbox “Show advanced options” and there you find an option Custom Element Shortcode Buttons where you can select to group the custom elements similar to the normal elements.
If you have programming skills:
enfold\config-templatebuilder\avia-template-builder\php\element-templates.class.php line 2283:
usort( $tab, array( $this, 'sortByOrder' ) );
is the place where the default sort order is created in $tab.
We can add a filter here in the next release if this helps you.
Best regards,
Günter
Understood, thanks Gunter – a filter for this would be great!
Hi,
I added this filter:
usort( $tab, array( $this, 'sortByOrder' ) );
/**
* @since 4.8.2
* @param array $tab
* @param array $tabs
* @param string $key
* @return array
*/
$tab = apply_filters( 'avf_custom_elements_buttons_sort_order', $tab, $tabs, $key );
Will be in next update.
Best regards,
Günter