Skip to content

Instantly share code, notes, and snippets.

@brentjett
Last active July 21, 2019 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brentjett/3c6cf1c9b09ac4e619ae to your computer and use it in GitHub Desktop.
Save brentjett/3c6cf1c9b09ac4e619ae to your computer and use it in GitHub Desktop.
Theme & Beaver Builder Theme Hook Concepts
<?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