Skip to content

Instantly share code, notes, and snippets.

View carlosonweb's full-sized avatar

Carlos Velasco carlosonweb

View GitHub Profile
@carlosonweb
carlosonweb / bb-clickble-col.js
Last active December 21, 2023 19:38
Make a BB Column Clickable
/**
* Makes a BB Column clickable.
* Pre-requisite: There must be an A Tag contained within the column element.
*/
(function($){
// Exit if BB layout is in edit mode.
if ( 'undefined' != typeof window.FLBuilderConfig ) {
return;
}
@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 / bb-nav-menu-hover-to-click.php
Last active February 27, 2022 10:21
On Beaver Builder Theme, prevent the Navigation Menu from displaying submenu items on hover and instead do it on click.
<?php
add_action('wp_footer', function(){
if ( is_admin() ) return;
?>
<script id="remove-menu-hover">
jQuery(document).ready(function($){
setTimeout(function(){
$('nav.fl-page-nav ul.navbar-nav > li.menu-item-has-children').off('mouseenter mouseleave');
$('nav.fl-page-nav ul.navbar-nav > li.menu-item-has-children > a').on('click', function(event){
event.preventDefault();
@carlosonweb
carlosonweb / beaver-themer-wc-notices.php
Created December 14, 2018 03:04
Move the WooCommerce Notices on the Beaver Themer Singular Product Layout to Anywhere on the layout via a Custom Shortcode
/**
* First, remove WooCommerce Notices box from its default location on the page (somewhere at the top).
*/
remove_filter( 'fl_theme_builder_before_render_content', 'FLThemeBuilderWooCommerceSingular::before_render_content' );
/**
* Create this shortcode : [fl_woocommerce_notices]
* You can embed this anywhere on the Themer Layout via the HTML module.
*/
add_shortcode( 'fl_woocommerce_notices', function() {
@carlosonweb
carlosonweb / bb-sportspress-conflict.php
Last active October 24, 2020 07:38
Issue: Beaver Builder Posts Module's Taxonomy filters ( Content > Filter) don't work on SportsPress CPTs and taxonomies.
<?php
/**
*
* This happens only for non-logged in users or logged in users who don't have a SportsPress User Role.
* There are several custom taxonomies used by SportsPress, but the code below should fix it for the Leagues (sp_league) taxonomy.
*
* Use the following filter hooks to the other SportsPress taxonomies.
* -- 'sportspress_register_taxonomy_season' for Season (sp_season).
* -- 'sportspress_register_taxonomy_venue' for Venues (sp_venue)
* -- 'sportspress_register_taxonomy_position' for Positions (sp_position)
@carlosonweb
carlosonweb / bb-loop-query-args.php
Last active February 14, 2020 18:57
Beaver Builder Filter Hook: fl_builder_loop_query_args To Filter by Meta Keys
/**
* Add this to the child theme's functions.php file.
*/
add_filter( 'fl_builder_loop_query_args', function( $query_args ){
$today = date( 'd.m.Y', time() );
// Past ( today > start_date )
if ( 'PAST_POST_MODULE_ID_HERE' == $query_args[ 'settings' ]->id ) {
$query_args[ 'meta_query' ] = array(
'key' => 'end_date',
@carlosonweb
carlosonweb / search.php
Last active October 2, 2019 11:26
Custom Search Results Page for Beaver Builder Child Theme
/**
*
* BB Theme Search Results Page with no sidebars.
* I added as well the ID = "bb-custom-search-result" so you can apply custom CSS to it.
*
* Try the CSS below, for example, to remove the right border and increase the width of the search results content.
*
* @media (min-width: 992px){
* #bb-custom-search-result{
* border: none;
@carlosonweb
carlosonweb / bb-smooth-scrolling.js
Last active September 20, 2019 04:08
Code Tweaks for Beaver Builder Smooth Scrolling
/**
*
* Tweak the code here:
*
* https://kb.wpbeaverbuilder.com/article/634-smooth-scrolling-tweaks-with-code
*
* to make it work when the anchor link is coming from another page.
*
*/
@carlosonweb
carlosonweb / themer-custom-field.php
Last active July 31, 2019 21:46
Sample Code to Customize Themer Connection Field
<?php
/**
*
* This is a stripped down code based on the sample in this doc:
*
* https://kb.wpbeaverbuilder.com/article/391-customize-field-connections-themer
*
*/
add_action( 'fl_page_data_add_properties', function() {
@carlosonweb
carlosonweb / class-fl-child-theme.php
Created June 7, 2019 03:41
BB Ticket 82857 -- Change Widget Title Hx Tag (Default tag in the BB Parent Theme is h4)
<?php
/**
* Helper class for child theme functions.
*
* @class FLChildTheme
*/
final class FLChildTheme {
/**