Skip to content

Instantly share code, notes, and snippets.

@zackpyle
Created February 19, 2024 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zackpyle/3479d4bfeca86cd62e34305fe066e3cd to your computer and use it in GitHub Desktop.
Save zackpyle/3479d4bfeca86cd62e34305fe066e3cd to your computer and use it in GitHub Desktop.
Create a custom order for the Beaver Builder admin bar dropdown #beaverbuilder
<?php
add_filter( 'fl_theme_builder_current_page_layouts', function( $layouts ) {
// Custom order
$custom_order = ['header', 'singular', 'archive', '404', 'part' , 'footer'];
$sorted_layouts = [];
// Populate sorted_layouts based on custom_order
foreach ($custom_order as $type) {
if (isset($layouts[$type])) {
$sorted_layouts[$type] = $layouts[$type];
}
}
// Add any layout types not added to your custom order that are in $layouts
foreach ($layouts as $type => $layout_array) {
if (!isset($sorted_layouts[$type])) {
$sorted_layouts[$type] = $layout_array;
}
}
return $sorted_layouts;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment