Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Prosser Pross

View GitHub Profile
@Pross
Pross / functions.php
Created Dec 7, 2020
Add Notes to all rows and columns
View functions.php
add_filter( 'fl_builder_register_settings_form', function( $form, $id ) {
if ( in_array( $id, array( 'row', 'col' ) ) ) {
$form['tabs']['notes'] = array(
'title' => 'Notes',
'sections' => array(
'notes' => array(
'title' => '',
'fields' => array(
'note' => array(
'title' => 'Note',
@Pross
Pross / gist:4cf9787acd67d5df512a788a0c620589
Created Oct 12, 2020
Enable quick edit for modules, saved rows etc
View gist:4cf9787acd67d5df512a788a0c620589
add_action( 'admin_init', function() {
remove_action( 'post_row_actions', 'FLBuilderUserTemplatesAdminList::row_actions' );
} );
@Pross
Pross / theme.patch
Created Sep 21, 2020
Filer to disable smoothscroll >> `add_filter( 'fl_theme_disable_smoothscroll', '__return_true' );`
View theme.patch
From 7485624b4814ccafb6edefc1358be7ca3f531478 Mon Sep 17 00:00:00 2001
From: Simon Prosser <pross@pross.org.uk>
Date: Mon, 21 Sep 2020 20:06:41 +0100
Subject: [PATCH] New filter fl_theme_disable_smoothscroll to disable
smoothscroll
add_filter( 'fl_theme_disable_smoothscroll', '__return_true' );
Fixes #148
---
classes/class-fl-theme.php | 6 +++++-
View gist:192abd46cde729109854409295596e60
add_shortcode( 'form1', function( $atts ) {
$rst = ( isset( $atts['rst'] ) ) ? $atts['rst'] : '9.00';
$msp = ( isset( $atts['msp'] ) ) ? $atts['msp'] : '16.00';
ob_start();
?>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-route.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-resource.js"></script>
<div id="rst_calc_main" ng-app="rstApp" ng-controller="rstCtrl">
<div class="table-responsive"></div>
@Pross
Pross / functions.php
Last active Jul 15, 2020
Replace Pagely urls in Beaver Builder with optional webp support
View functions.php
<?php
/**
* Replace Pagely urls in Beaver Builder
* @author Simon Prosser
* @license MIT
*/
class PagelyCDNReplace {
static $site_url = 'https://example.com'; // Your site url
static $cdn_url = 'https://cdn.example.io'; // Your CDN url
View bxslider.min.js
!function(t){var e={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,wrapperClass:"bx-wrapper",touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,ariaLive:!0,ariaHidden:!0,keyboardEnabled:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",stopAutoOnClick:!1,autoHover:!1,autoDelay:0,autoSlideForOnePage:!1,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,shrinkItems:!1,onSliderLoad:function(){return!0},onSlideBefore:function(){return!0},onSlideAfter
View gist:9ef31db3481f70b7472ac333714ad39f
(function($) {
$(document).ready(function() {
var done = false;
$(window).on('scroll', function() {
if (done) {
return false;
}
if (isScrolledIntoView('.fl-module-post-grid')) {
done = true;
$(window).trigger('resize');
View functions.php
add_shortcode( 'something_unique', function() {
$now = strtotime( 'now' ); // The time now (in seconds).
$fixed_eot_time = strtotime( '31 August 2020' ); // Future time (in seconds).
$days_until_fixed_eot_time = round( ( $fixed_eot_time - $now ) / DAY_IN_SECONDS );
return do_shortcode( sprintf( '[s2Member-Pro-PayPal-Form level="1" ccaps="" desc="RIAPP Member / Professional Annual Membership" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="riapp.lenadev.com" ta="0" tp="0" tt="D" ra="0.01" rr="BN" rt="D" rp="%s" rrt="" rra="2" accept="paypal,visa,mastercard,amex,discover,maestro,solo" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="0" /]', $days_until_fixed_eot_time ) );
});
View gist:3dd37b8e2038fc8f7bd47014cdc92878
add_filter( 'fl_builder_get_cache_dir', function( $dirinfo ){
if ( 'icons' === basename( $dirinfo['path'] ) ) {
$dirinfo['path'] = trailingslashit( get_stylesheet_directory() ) . 'icons/';
$dirinfo['url'] = trailingslashit( get_stylesheet_directory_uri() ) . 'icons/';
}
return $dirinfo;
});
View functions.php
add_action(
'init',
function() {
if ( isset( $_GET['layout_nuke_js'] ) && is_numeric( $_GET['layout_nuke_js'] ) ) {
$data = get_post_meta( $_GET['layout_nuke_js'], '_fl_builder_data_settings', true );
$draft = get_post_meta( $_GET['layout_nuke_js'], '_fl_builder_draft_settings', true );
$data->js = '';
$draft->js = '';
update_post_meta( $_GET['layout_nuke_js'], '_fl_builder_data_settings', $data );
update_post_meta( $_GET['layout_nuke_js'], '_fl_builder_draft_settings', $draft );
You can’t perform that action at this time.