Skip to content

Instantly share code, notes, and snippets.

View modemlooper's full-sized avatar
🏠
Working from home

modemlooper modemlooper

🏠
Working from home
View GitHub Profile
@wpscholar
wpscholar / wp-rest-api-add-gutenberg-blocks.php
Last active March 15, 2022 01:19
Surface all Gutenberg blocks in the WordPress REST API
<?php
add_action('rest_api_init', function() {
// Surface all Gutenberg blocks in the WordPress REST API
$post_types = get_post_types_by_support( [ 'editor' ] );
foreach ( $post_types as $post_type ) {
if ( gutenberg_can_edit_post_type( $post_type ) ) {
@Shelob9
Shelob9 / README.md
Created June 24, 2016 20:44
Add upsells to higher variable price in EDD checkout. See README

This adds an upsell option in the EDD checkout for products with variable prices. Each option that has a higher price is shown, and then when you click that, it changes the price.

To see it in action, go to https://CalderaWP.com/caldera-forms-add-ons/ choose and add-on and add it to cart. Then you should see the two more expensive options listed. Click them to get upsold.

This requires EDD 2.6 or the hook will not have the 2nd arg (awesomemotive/easy-digital-downloads#4685)

Things I plan to add to this:

  • Better CSS
  • Analytics tracking
  • Ingot powered A/B testing for how to phrase the the upsell text.
@eduardo22i
eduardo22i / PHP Appstore Validator
Last active November 13, 2020 04:44
A file to validate an AppStore payment receipt using PHP.
<?php
//
// Appstore Production Purchase Validation
//
// Created by Eduardo Irías on 6/3/16.
//
$filebinary = basename($_FILES['receipt-data']['name']);
@jazzsequence
jazzsequence / update-forum-groupmeta.php
Last active April 19, 2016 19:20
Updates the group meta for forum id based on updated forum ids.
<?php
/*
Plugin Name: WDS CLP Update Forum Group Meta Script
Description: Updates the group meta for forum id based on updated forum ids.
Author: WebDevStudios
Author URI: http://webdevstudios.com
Version: 1.0
License: GPL2
*/
angular.module('sfViewCtrlDirective', [])
.directive('open', OpenDirective);
function OpenDirective() {
return {
restrict: 'A',
link: function($scope, $element, $attr) {
console.log('device is ready');
$element.on('click', function() {
@JRGould
JRGould / wp-migrate-db-pro-tweaks.php
Created August 5, 2015 19:19
WP Migrate DB Pro Tweaks - edited to allow utf8mb4 to utf8 migrations
<?php
/*
Plugin Name: WP Migrate DB Pro Tweaks
Plugin URI: http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks
Description: Examples of using WP Migrate DB Pro's filters
Author: Delicious Brains
Version: 0.1
Author URI: http://deliciousbrains.com
*/
@djabif
djabif / dynamicAnchorFix.js
Last active March 18, 2017 09:27
Directive to open external links in Ionic App using inAppBrowser cordova plugin
//Use this directive to open external links using inAppBrowser cordova plugin
.directive('dynamicAnchorFix', function($ionicGesture, $timeout, $cordovaInAppBrowser) {
return {
scope: {},
link: function(scope, element, attrs) {
$timeout(function(){
var anchors = element.find('a');
if(anchors.length > 0)
{
angular.forEach(anchors, function(a) {
@bnagy
bnagy / gpgmutt.md
Last active March 30, 2024 07:52
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
@jchristopher
jchristopher / gist:fc1d461bd82b40e31290
Last active August 30, 2019 18:45
Tell SearchWP to extract PDF contents of a file uploaded to an ACF file upload field and store that content with the post itself as custom metadata, not the Media entry
<?php
/**
* Extract PDF content from a file uploaded via ACF File field (where
* the actual data stored is only the Media ID) and store PDF
* content as SearchWP 'extra' metadata so it can be included in
* searches and attributed to the post itself, not the Media entry
*/
class My_SearchWP_Customizations {
@rogerlos
rogerlos / searchwp_results_substitute_post_for_attachment.php
Created November 11, 2014 23:49
Wordpress SearchWP: Substitute Post for Attachment in Search Results
<?php
/**
* This function will see if a PDF or other "attachment" post-type returned by SearchWP
* is present in a custom field in a regular post, and will return that post instead. Note
* this will only process documents which are referenced via the "attachment" post type.
*
* For example, you may have a product specification PDF and would like it in the search
* results, but would rather people got to it by visiting the product page itself.
*