Skip to content

Instantly share code, notes, and snippets.

View Pross's full-sized avatar
💬

Simon Prosser Pross

💬
View GitHub Profile
@mikejolley
mikejolley / ipn-test.php
Last active September 18, 2020 14:29
Quick snippet/plugin/dropin to test IPN support
<?php
/**
* Plugin Name: PayPal Sandbox IPN Tester
* Description: Pings the IPN endpoint to see if your server can connect. Just head to <a href="/?ipn-test=1">yoursite.com/?ipn-test=1</a> whilst logged in as admin.
* Version: 1.0.0
* Author: WooThemes
* Requires at least: 4.1
* Tested up to: 4.3
*/
if ( ! defined( 'ABSPATH' ) ) {
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 );
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

@JeremyEnglert
JeremyEnglert / beaver.php
Last active October 2, 2019 11:22
Set BeaverBuilder as Default Editor
<?php
// Sets Beaver Builder as the default editor.
function make_beaver_builder_default( $post_ID, $post, $update ) {
if ( ! $update ) {
update_post_meta( $post_ID, '_fl_builder_enabled', true );
}
}
add_action( 'wp_insert_post', 'make_beaver_builder_default', 10, 3 );
@Pross
Pross / js.js
Created January 21, 2019 18:30
How to paste random jQuery from the internet.
(function($){
$(document).ready(function(){
// This runs on ready function
// Add Copy+Pasta here
});
})(jQuery);
@markjaquith
markjaquith / .all
Last active October 10, 2018 15:38
Bash stuff
for f in ~/Dropbox/bash/*; do source $f; done
@Pross
Pross / user.js
Last active August 16, 2018 12:53
Adds a dropdown to WordPress.org post reply with scripted replies.
// ==UserScript==
// @name WordPress.org Scripted Replies
// @description Scripted Replies
// @grant none
// @updateURL https://gist.github.com/Pross/92e20d3e42da67adb57a44f7102543e2/raw/user.js
// @downloadURL https://gist.github.com/Pross/92e20d3e42da67adb57a44f7102543e2/raw/user.js
// @include https://*.wordpress.org/support/topic/*
// @include https://*.wordpress.org/support/view/*
// @include https://wordpress.org/support/topic/*
// @include https://wordpress.org/support/view/*
<?php
/*
Plugin Name: PageLines DMS Toolbar Customizer
Author: TourKick (Clifford P)
Author URI: http://tourkick.com/?utm_source=pagelines&utm_medium=plugin&utm_content=pluginuri&utm_campaign=dmstoolbarcustomizer
Plugin URI: http://www.pagelinestheme.com/remove-dms-editor-toolbar-items-2/?utm_source=pagelines&utm_medium=plugin&utm_content=pluginuri&utm_campaign=dmstoolbarcustomizer
Description: Removes 'Get More Sections' link from Add To Page panel, removes Theme panel, and removes DMS panel from the DMS editor for non-Administrators (e.g. Editors). <strong>Edit the plugin's file to customize other options.</strong> May also choose to copy code directly into your DMS child theme's functions.php file instead of activating this plugin. <a href="http://www.pagelinestheme.com/dms-editor-lock-down/" target="_blank">http://www.pagelinestheme.com/dms-editor-lock-down/</a> may also be helpful.
License: GPLv2
Version: 1.1.20131105
*/
@Pross
Pross / denyhosts.php
Last active December 16, 2015 16:19
DenyHosts for wordpress
<?php
/*
Plugin Name: DenyHosts
Plugin URI: http://pross.org.uk
Description: Block bad login attempts.
Version: 1.0
Author: Pross
*/
class DenyHosts {