Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home...like always

Brent Jett brentjett

🏠
Working from home...like always
View GitHub Profile
@brentjett
brentjett / bb-theme-hook-concepts.php
Last active Jul 21, 2019
Theme & Beaver Builder Theme Hook Concepts
View bb-theme-hook-concepts.php
<?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";
}
@brentjett
brentjett / beaver-builder-friendly.php
Created Oct 26, 2015
Making a Theme Beaver Builder Friendly
View beaver-builder-friendly.php
<?php
// I add a simple function to my functions.php that lets me do clean page-builder checks inside my template files.
// This is safe to include regardless of if bb-plugin is active or not. Won't trigger error.
function is_builder_layout() {
if (class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_enabled()) return true;
return false;
}
// Inside page.php I use is_builder_layout() to determine layout
if (is_builder_layout()) {
@brentjett
brentjett / extended-libraries-api-scratchwork.php
Last active Aug 29, 2015
Advanced CSS/JS API for WordPress - API Scratchwork
View extended-libraries-api-scratchwork.php
<?php
// Extend wp_enqueue_script & wp_enqueue_style to support callbacks.
function beagle_enqueue_style_callback($handle = "script-name", $callback_fun, $callback_args, $enqueue_query = array()) {}
beagle_enqueue_style_callback('my-gallery-css', function() {
ob_start();
?>
body {
background:red;
@brentjett
brentjett / gist:88ed38f756e9ac79cbe6
Last active Aug 29, 2015
Template Enqueue Scratchwork
View gist:88ed38f756e9ac79cbe6
/*
Basset Theme
Template Enqueue Scratchwork
The idea is to allow a template file to declare it's own dependancies using a comment header similar to the style.css file or plugins.
*/
// Template index.php
<?php
/*
@brentjett
brentjett / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@brentjett
brentjett / WordPress User Query
Last active Aug 29, 2015
WordPress User Query Example
View WordPress User Query
<?php
$args = array(
'order' => 'ASC',
'meta_key' => 'user-is-coach',
'meta_value' => 'yes'
);
$coaches = new WP_User_Query($args);
$coaches = $coaches->results;
foreach($ordered_coaches as $coach) {
@brentjett
brentjett / ACF_OptionsPageTemplate
Last active Aug 29, 2015
Create an ACF (Advanced Custom Fields) Options Page
View ACF_OptionsPageTemplate
<?php
/*
In the global scope
*/
if(function_exists('acf_add_options_sub_page')) {
acf_add_options_sub_page(array(
'title' => 'Nourish-mint Options',
'parent' => 'themes.php' /* Name of Admin file to parent or path to custom plugin page */
));