Skip to content

Instantly share code, notes, and snippets.

View gbissland's full-sized avatar

Gareth Bissland gbissland

View GitHub Profile
@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);
@polevaultweb
polevaultweb / acf_pro_license_constant.php
Last active March 22, 2023 03:06
Define the Advanced Custom Fields Pro license key with a constant
<?php
function my_filter_acf_pro_license_option( $pre ) {
if ( ! defined( 'ACF_PRO_LICENSE' ) || empty( ACF_PRO_LICENSE ) ) {
return $pre;
}
$data = array(
'key' => ACF_PRO_LICENSE,
'url' => home_url(),
@andrewlimaza
andrewlimaza / my-pmpro-change-seat-to-member.php
Last active July 29, 2024 09:27
Change the word "Seat(s)" to "Member(s)" for Paid Memberships Pro Sponsored Members Add On.
<?php
/**
* This will change all instances of seat(s) to member(s) for the Sponsored Members Add On - https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
* Add the code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_change_seat_to_member( $output_text, $input_text, $domain ) {
if ( 'pmpro-sponsored-members' === $domain ) {
$output_text = str_replace( 'seats', 'members', $output_text );
$output_text = str_replace( 'Seats', 'Members', $output_text );
add_filter( 'fl_module_upload_regex', function( $regex, $type, $ext, $file ) {
$regex['photo'] = '#(jpe?g|png|gif|bmp|tiff?|svg)#i';
return $regex;
}, 10, 4 );
@Pross
Pross / gist:ae7f81249c5f61b33fd06c2a35284ad9
Last active December 4, 2019 19:07
2.2 from earlier versions

Allow Beaver Builder to update to 2.2 from 2.1 before auto updates are enabled.

To start with auto updates are disabled when 2.2 is released and you have to update manually by downloading the zip from your account area. With this simple file edit you can let WP do the update as if auto updates were enabled.

!Caution! Please make sure you do a backup before ANY WP plugin updates

@andrewlimaza
andrewlimaza / pay-by-check-instructions.php
Last active June 25, 2020 18:48
Load Pay By Check Instructions Before Billing Address Details
<?php
/**
* Change location where the Pay By Check Instructions are displayed when the Address For Free Levels Add On is installed.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_change_location_for_checkout_instructions() {
remove_filter('pmpro_checkout_after_payment_information_fields', 'pmpropbc_pmpro_checkout_after_payment_information_fields' );
add_filter('pmpro_checkout_boxes', 'pmpropbc_pmpro_checkout_after_payment_information_fields', 25 );
}
<?php
/**
*-----------------------------------------------------------
* Add publisher logo/image schema for Beaver Builder plugin
*-----------------------------------------------------------
*
* Filter: 'fl_schema_meta_publisher_image_url'
* Defined in: bb-plugin/modules/post-grid/post-grid.php
*
<?php
/*
* Say you have table which table id is 101 and you want to filter some data
* Please disable caching for this table and load using ajax renderer
*/
add_filter('ninja_tables_get_public_data', function ($data, $tableId) {
if($tableId != 101) {
return $data; // Return if this is not our target table
}