Skip to content

Instantly share code, notes, and snippets.

View gbissland's full-sized avatar

Gareth Bissland gbissland

View GitHub Profile
@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;
}
@saniales
saniales / A-Transferwise-Slack-Integration-with-Cloudflare-Workers.md
Last active September 28, 2024 05:40
A TransferWise integration with Slack Webhooks using Cloudflare Workers

TransferWise webhook integration with Slack notifications using Cloudflare Workers

Greetings from the Tryvium Team,

Here is how to integrate a Transferwise webhook with Slack notifications. We have chosen to use cloudflare workers as a perfect case study for serverless applications using cloudflare.

Setting things up

@westcoastdigital
westcoastdigital / gp-svg-logo.php
Last active December 22, 2021 07:58
GeneratePress: Output inline SVG code instead of as an image
/** Updated and tested with GeneratePressVersion: 2.4.2 **/
/**
* Check if logo is svg and output svg code instead of image
*/
function generate_construct_logo() {
$logo_url = ( function_exists( 'the_custom_logo' ) && get_theme_mod( 'custom_logo' ) ) ? wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ) : false;
$logo_url = ( $logo_url ) ? $logo_url[0] : generate_get_option( 'logo' );
$logo_url = esc_url( apply_filters( 'generate_logo', $logo_url ) );
<?php // ignore this line, its only to make highlighting work
add_filter( 'fl_builder_render_module_content', function( $out, $module ) {
if ( 'heading' === $module->slug ) {
$string = $out;
$find = ' ';
$replace = '&nbsp;';
$out = strrev( preg_replace( strrev( "/$find/" ), strrev( $replace ), strrev( $string ), 1 ) );
}
return $out;
}, 10, 2);