Skip to content

Instantly share code, notes, and snippets.

View carlosonweb's full-sized avatar

Carlos Velasco carlosonweb

View GitHub Profile
@carlosonweb
carlosonweb / wp-configs-snippets.php
Last active March 25, 2023 19:12
Recommended wp-config.php snippets for Beaver Builder
<?php
// Recommended for BB
define('WP_MEMORY_LIMIT', '512M');
define('FL_BUILDER_MODSEC_FIX', true);
// Enable Debugging
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
// Etc
@carlosonweb
carlosonweb / show-child-pages-on-parent.php
Last active October 30, 2017 20:25
A shortcode to display the child pages of a parent page.
<?php
/**
* A shortcode to display the child pages of a parent page.
*
* Usage: Simply embed [show_childpages_on_parent] on the parent page.
*
*/
add_shortcode('show_childpages_on_parent', function(){
global $post;
$html = '';
@carlosonweb
carlosonweb / bb-random-content-slider.js
Last active January 17, 2019 08:20
Randomize Display of Beaver Builder Content Slider
jQuery(document).ready(function($){
var $slider = $('#bbcw-content-slider .fl-content-slider-wrapper').data('bxSlider'),
slideCount = $slider.getSlideCount();
$slider.goToSlide( Math.floor( Math.random() * slideCount ) );
});
@carlosonweb
carlosonweb / bb-sample-archive-template.php
Created October 16, 2017 20:50
Sample Beaver Builder Theme Custom Archive Template
<?php
/*
Template Name: BB Sample Archives
*/
?>
<?php get_header(); ?>
<div class="fl-archive container">
<div class="row">
@carlosonweb
carlosonweb / ee_bb_suppress_notices.php
Created October 9, 2017 03:25
Fix issue between BB and Event Espresso
// Issue: Event Espresso is outputting data to the page which is not needed by BB.
// https://cl.ly/mxHS
// --------------------------------------------------------------------------------
function ee_bb_suppress_notices(){
if (class_exists('FLBuilderModel') && (FLBuilderModel::is_builder_enabled())){
add_filter( 'FHEE__EE_Front_Controller__display_errors', '__return_false' );
}
}
add_action('wp', 'ee_bb_suppress_notices', 1);
@carlosonweb
carlosonweb / clear-cache-after-update.php
Last active December 22, 2017 01:06
Clear Cache After Theme or Plugin Update
add_action( 'upgrader_process_complete', function() {
//rocket cache
if ( function_exists( 'rocket_clean_domain' ) ) {
rocket_clean_domain();
}
// wp-super-cache
if ( function_exists( 'wp_cache_clear_cache' ) ) {
wp_cache_clear_cache();
@carlosonweb
carlosonweb / bb-search-results-page.php
Created October 4, 2017 21:09
Fix CSS issues on Search Results which contains Beaver Builder Pages
add_action( 'wp', function() {
if ( is_search() ) {
remove_action( 'wp_enqueue_scripts', 'FLBuilder::enqueue_all_layouts_styles_scripts' );
}
});
@carlosonweb
carlosonweb / random-start-bb-content-slider.js
Created October 2, 2017 07:26
Make the Beaver Builder's Content Slider Start Playing in Random Slide Number
//
// Content Slider ID = "bbcw-content-slider"
//
jQuery(document).ready(function($){
var $slider = $('#bbcw-content-slider .fl-content-slider-wrapper').data('bxSlider')
var slideCount = $slider.getSlideCount();
$slider.goToSlide( Math.floor( Math.random() * slideCount ) );
});
@carlosonweb
carlosonweb / cpt-navigation-shortcode.php
Created September 30, 2017 07:29
Display Previous Next Navigation Links via Shortcode
//
// For simplicity, the code below assumes that the CPT is 'project'
//
// TODO: Improve further.
// ------------------------------------------------
add_shortcode('project-navigation', function(){
$html = '';
$prev_post_link = '';
$next_post_link = '';
@carlosonweb
carlosonweb / bb-fix-cdn.php
Created September 28, 2017 02:16
Fix URL References for Background Images used on Beaver Builder Modules and Rows
add_filter( 'fl_builder_render_css', function( $css ) {
return str_ireplace( 'example.com', 'cdn-url.example.com', $css );
});