Skip to content

Instantly share code, notes, and snippets.

View carlosonweb's full-sized avatar

Carlos Velasco carlosonweb

View GitHub Profile
@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 / 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 {
/**
@carlosonweb
carlosonweb / collapse-bb-tabs.js
Created June 6, 2019 01:55
Collapse the All Tab on Beaver Builder Tabs Module When Viewed on Small Screen
jQuery( window ).on('resize', function() {
var $ = jQuery;
if ( $(window).width() <= FLBuilderLayoutConfig.breakpoints.small ){
$( '.bbtest-tabs .fl-tabs-panel .fl-tabs-label[data-index=0] i' ).addClass( 'fa-plus' );
$( '.bbtest-tabs .fl-tabs-panel .fl-tabs-panel-content[data-index=0] ').hide();
$( '.bbtest-tabs .fl-tabs-panel .fl-tabs-label[data-index=0]' ).removeClass( 'fl-tab-active' );
$( '.bbtest-tabs .fl-tabs-panel .fl-tabs-panel-content[data-index=0] ').removeClass( 'fl-tab-active' );
}
@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 / fl_builder_loop_query_args-filter.php
Last active January 2, 2019 09:06
TEC vs Post "fl_builder_loop_query_args" Filter Hook
<?php
/**
*
* This works on regular post type.
*
*/
add_filter( 'fl_builder_loop_query_args', function( $query_args ){
$today = date( 'Y-m-d H:i:s', time() );
if ( is_page( 'display-past-events' ) && ( 'bbtest-posts-past-events' === $query_args[ 'settings' ]->id ) ) {
@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 / class-fl-child-theme.php
Last active December 12, 2018 22:17
Better BB Child Theme Helper Class
<?php
/**
* Helper class for child theme functions. This is a better version as it uses the child theme's version number.
*
* @class FLChildTheme
*/
final class FLChildTheme {
/**
* Enqueues scripts and styles.
@carlosonweb
carlosonweb / bb-wp-all-import.php
Created October 17, 2018 02:59
Fix WP All Import Problem
<?php
/**
* Add the code to All Import > Settings > Function Editor.
*/
function clear_bb_cache_after_wpai_import($import_id) {
FLBuilderModel::delete_asset_cache_for_all_posts();
}
add_action( 'pmxi_after_xml_import', 'clear_bb_cache_after_wpai_import', 10, 1);
@carlosonweb
carlosonweb / bb-smooth-scrolling-bottom.php
Last active October 5, 2018 03:22
BB Smooth Scrolling Code Tweak Loaded At the Bottom of the Page
/**
*
* It's essentially the same code here:
* https://kb.wpbeaverbuilder.com/article/634-smooth-scrolling-tweaks-with-code
*
* I'm just using "wp_footer" action hook to load the code to the bottom of the page (see priority = 999).
* You need to change 'page-slug-here' in LINE 10 to correspond with the target page.
*
*/
add_action ( 'wp_footer', function(){