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 / 48380.php
Created February 27, 2018 00:00
Wrap in Custom Shortcode
add_shortcode( 'paypal_buy_now' , function(){
ob_start();
?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" type="hidden" value="_s-xclick" /> <input name="hosted_button_id" type="hidden" value="FPVL6DHVC9KE8" />
<select name="os0">
<option value="Single Line">Single Line $25.00 USD</option>
<option value="1/4 Page (4.5&quot; x 2&quot; or 2.25&quot; x 4&quot;)">1/4 Page (4.5" x 2" or 2.25" x 4") $60.00 USD</option>
<option value="1/2 Page (4.5&quot; x 4&quot;)">1/2 Page (4.5" x 4") $115.00 USD</option>
<option value="3/4 Page (4.5&quot; x 6&quot;)">3/4 Page (4.5" x 6") $165.00 USD</option>
<option value="Full Page (4.5&quot; x 8&quot;)">Full Page (4.5" x 8") $225.00 USD</option>
@carlosonweb
carlosonweb / row-attr.php
Created March 16, 2018 23:47
Add Row Custom Attributes To A Beaver Builder Row
add_filter( 'fl_builder_row_attributes', function( $attrs, $row ){
if ( $row->settings->id === 'ROW-ID-HERE' ){
$attrs['data-THE-FIELD-HERE'] = 'THE-VALUE-HERE';
}
return $attrs;
}, 10, 2 );
@carlosonweb
carlosonweb / Puzzle-Full-Width-Template.php
Last active August 10, 2018 23:24
Beaver Builder Theme Full-Width Page Template for the Puzzle CPT
<?php
/*
Template Name: Puzzle Full Width
Template Post Type: puzzle
*/
get_header();
@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 / bt-product-images-compatibility.php
Last active August 10, 2018 23:23
Code Snippets For Beaver Themer Product Images Compatibility With Other Plugins
<?php
// Compatibility issue with Elegant Product Gallery Zoon
// https://www.silkypress.com/elegant-product-gallery-zoom/
add_filter ( "fl_theme_builder_woocommerce_template_html_woocommerce_show_product_images", function ( $func ) {
return 'load_product_gallery_template';
} );
function load_product_gallery_template() {
if ( in_array( 'product-gallery-zoom/product-gallery-zoom.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
include_once ABSPATH . '/wp-content/plugins/product-gallery-zoom/includes/gallery-template.php';
@carlosonweb
carlosonweb / bb-smooth-scroll.js
Created October 2, 2018 00:48
Beaver Builder Smooth Scrolling From Another Page
/**
*
* Smooth Scrolling from another page.
* To be paired with this code:
* https://kb.wpbeaverbuilder.com/article/634-smooth-scrolling-tweaks-with-code
*
*/
jQuery(document).ready(function($) {
var hashLink = $(window.location.hash),
offsetSize = $("header").innerHeight() + 40;
@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(){
@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 / 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.