Skip to content

Instantly share code, notes, and snippets.

View gbissland's full-sized avatar

Gareth Bissland gbissland

View GitHub Profile
@gingersoulrecords
gingersoulrecords / bbtoolbarfix.css
Last active October 16, 2021 11:31
CSS that makes the Beaver Builder toolbar actions more distinct than the defaults.
/* Paste all of this into your Global CSS file, or anywhere else you place CSS in your site. */
[data-action="discard"] {
background: none;
color: #CE3F40!important;
}
[data-action="discard"]:after {
content: "\00a0 changes ×";
}
@codente
codente / bb-pre-populate-page-template.php
Created October 5, 2021 13:28
bb-pre-populate page with template
// Uses the add_meta_boxes_{post_type} hook for given post type
// change page in hook to your post type where you want this to happen
add_action( 'add_meta_boxes_page', 'page_default_content' );
function page_default_content( WP_Post $page ) {
// Add the meta data fields you want the custom post type to grab
$page_meta_data = [
'_fl_builder_enabled',
'_fl_builder_data_settings',
@Pross
Pross / bb-cleanup.php
Created September 1, 2021 18:30
Mini plugin for Beaver Builder that clears all history states and draft data weekly for people on crippled potato hosting.
<?php
/*
Plugin Name: Beaver Builder Cleanup Tool
Description: Clears temporary data weekly
Author: <Simon>
Version: 1.0
*/
class BB_Cleanup {
protected $seconds = 604800; // Weekly.
function __construct() {
@afragen
afragen / git-updater-ignore.php
Last active September 13, 2024 19:53
A plugin to ignore specific repositories from Git Updater
<?php
/**
* Plugin Name: Git Updater Ignore
* Plugin URI: https://gist.github.com/afragen/414612961ac500b652862096a54d62d7
* Description: This plugin is used to set Git Updater to ignore specific repository slugs.
* Version: 0.3
* Author: Andy Fragen
* License: MIT
* Requires at least: 5.2
* Requires PHP: 5.6
@petertwise
petertwise / acf-install-license
Last active October 2, 2025 05:54 — forked from polevaultweb/acf_pro_license_constant.php
Define the Advanced Custom Fields Pro license key with a constant
#!/bin/bash
# Setup ACF Pro to use a license key in wp-config
#
# 1. Place your license key in a file called .acf-license-key somewhere your ssh user has access to it.
# Default is in your home directory: ~/.acf-license-key
# Change the setting below if you need to put it somewhere else
# 2. install this file in /usr/local/bin or someplace in your PATH
# 3. make sure you have WP CLI installed
# 4. run acf-install-license from the root of your wordpress install
<?php
/**
* Sample for fields you can add to a business directory, includeding conditional business types
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
@chris-castillo-dev
chris-castillo-dev / manage-wp-modsec-exclusion.txt
Last active May 11, 2020 20:26
Modsec - Whitelabel ManageWP
# Modify the REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf file located at:
# /etc/nginx/modsec/owasp/rules/
# Add the code block below to the end of your file.
# After saving the .conf file .. don't forget to run the following commands:
# 1. "nginx -t" to test the configuration. If the tests are successful reload the server
# 2. "gp nginx -reload"
SecRule REQUEST_HEADERS:X-Real-IP "@ipMatch 34.211.180.66,54.70.65.107,34.210.224.7,52.41.5.108,52.35.72.129,54.191.137.17,35.162.254.253,52.11.12.231,52.11.29.70,52.11.54.161,52.24.142.159,52.25.191.255,52.34.126.117,52.34.254.47,52.35.82.99,52.36.28.80,52.39.177.152,52.41.237.12,52.43.13.71,52.43.76.224,52.88.96.110,52.89.155.51,54.187.92.57,54.191.32.65,54.191.67.23,54.191.80.119,54.191.135.209,54.191.136.176,54.191.148.85,54.191.149.8,52.26.122.21,52.24.187.29,52.89.85.107,54.186.128.167,54.191.40.136,52.88.119.122,52.89.94.121,52.25.116.116,52.88.215.225,54.186.143.184,52.88.197.180,52.27.171.126,34.211.178.241,52.24.232.158,52.26.187.210,52.42.189.119,54.186.2
@ivo-ivanov
ivo-ivanov / delete-acf-data-after-field-removal.php
Last active August 15, 2024 14:17
Delete all data from WP database when an ACF field is deleted. #wordpress #acf
/*Deleting content when an ACF field is deleted is easy, relatively. Please note that the use of this function cannot be undone and it will erase all traces of content for any ACF field that is deleted.
Please be sure that this is something that you want to do before implementing this and I would strongly suggest that this is only enabled during development and not on a live site. Should a client go into ACF for some reason and delete a field, there is nothing that you’d be able to do to recover form it. */
// this action is run by ACF whenever a field is deleted
// and is called for every field in a field group when a field group is deleted
add_action('acf/delete_field', 'delete_acf_content_on_delete_field');
function delete_acf_content_on_delete_field($field) {
// runs when acf deletes a field
<?php
/*
Plugin Name: Beaver Builder Global JS Reset
Description: Resets global JS and self deactivates.
Author: <Simon>
Version: 1.0
*/
class BB_Global_JS_Reset {
function __construct() {
include_once ABSPATH . '/wp-admin/includes/plugin.php';
//Line 2055
if ( 'parallax' == $row->settings->bg_type && ! empty( $row->settings->bg_parallax_image_src ) ) {
$attrs['data-parallax-speed'] = $row->settings->bg_parallax_speed;
$attrs['data-parallax-image'] = $row->settings->bg_parallax_image_src;
$attrs['data-parallax-offset'] = $row->settings->bg_parallax_offset;
}