Last active
October 8, 2024 22:20
-
-
Save brentjett/3c6cf1c9b09ac4e619ae to your computer and use it in GitHub Desktop.
Theme & Beaver Builder Theme Hook Concepts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adding a style variation to certain elements | |
*/ | |
add_filter('fl_theme_classes', function($classes, $type, $object) { | |
// Add a special row style | |
if ($type == 'row') { | |
$classes['dark-row'] = "Dark Row"; | |
} | |
// Add a special button module stlye | |
if ($type == 'module' && $object->name == 'Button') { | |
$classes['super-button'] = "Super Button"; | |
} | |
return $classes; | |
}, 10, 3); | |
/** | |
* Declaring theme layouts - Saved layouts that are available in the them. | |
* Wants front-page.php to show front-page.xml layout | |
*/ | |
add_filter('fl_theme_layouts', function($layouts) { | |
// return layouts | |
$layouts['front-page'] = LAYOUT_DIR . 'front-page.xml'; | |
return $layout; | |
}); | |
/** | |
* In the front-page.php template | |
*/ | |
if (class_exists('FLBuilderModel') && has_layout('front-page')) { | |
do_layout('front-page'); | |
} else { | |
// do theme layout normally without builder | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment