brentjett
10/29/2015 - 3:35 PM

Theme & Beaver Builder Theme Hook Concepts

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
}
?>