Skip to content

Instantly share code, notes, and snippets.

@igorbenic
igorbenic / live.php
Created November 23, 2022 22:17
A simple shortcode to display results from World Cup 2022 using api-football.com APIs
<?php
/**
* Plugin Name: Live API
*/
add_action( 'init', function(){
add_shortcode( 'live_api', 'live_api_shortcode' );
});
function live_api_shortcode() {
@FreddieOliveira
FreddieOliveira / docker.md
Last active May 9, 2024 02:42
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@tanaikech
tanaikech / submit.md
Last active January 3, 2023 00:46
Inserting Text on Image using Google Apps Script
@igorbenic
igorbenic / add-cart-item.php
Last active February 21, 2024 21:34
Selling Simple Products as WooCommerce Subscriptions - Parts of code from tutorials | Selling Simple Products as WooCommerce Subscriptions - Admin | https://www.ibenic.com/selling-simple-products-woocommerce-subscriptions-front | https://www.ibenic.com/selling-simple-products-woocommerce-subscriptions-admin
<?php
namespace Simple_Product_Subscriptions;
class Cart {
/**
* Cart Hooks
@zackkatz
zackkatz / gravityview-gravity-flow-clear-cache.php
Last active July 29, 2020 06:50
GravityView - Clears results cache after running Gravity Flow workflow
<?php
// Add the code below to your functions.php file. Will be included in GravityView 2.9 release.
add_action( 'gravityflow_post_process_workflow', 'gv_clear_cache_after_workflow', 10, 4 );
/**
* Clears GravityView entry cache after running a Gravity Flow Workflow
*
* Thanks to @CodenomadIndia for improved code!
@mcaskill
mcaskill / wp-ajax.php
Last active May 6, 2024 16:20 — forked from yllus/admin-ajax.php
WordPress : A drop-in replacement for admin-ajax.php that is optimized for visitor-only AJAX requests.
<?php
/**
* WordPress Ajax Process Execution
*
* This file is a near-identical copy of {@see wp-admin/admin-ajax.php} from WordPress v6.3.0.
*
* Differences:
* 1. Constant `WP_ADMIN` is set to FALSE, by default.
* 2. WordPress action 'admin_init' is replaced with custom action 'ajax_init'.
* 4. Custom actions hooked on 'admin_init' are not executed.
@lukecav
lukecav / functions.php
Created May 11, 2020 15:36
Preserve MainWP option values for connections if using WP Migrate DB Pro
add_filter( 'wpmdb_preserved_options', function( $options ) {
$opts = [
'mainwp_child_uniqueId',
'mainwp_child_pubkey',
'mainwp_child_server',
'mainwp_child_nonce'
];
return array_merge($options, $opts);
});
@RadGH
RadGH / edit-gf-entry.php
Last active August 17, 2023 01:26
Edit an existing gravityforms entry on the frontend
<?php
/*
Plugin Name: GF Editable by Radley
Description: Example classes to make a particular gravity form editable on the front-end.
Author: Radley Sustaire
Author URI: https://radleysustaire.com/
Version: 1.0.0
*/
// QUICK TEST INSTRUCTIONS:
@spivurno
spivurno / gp-populate-anything-force-dyn-pop-on-gv-edit.php
Created April 6, 2020 00:12
Gravity Perks // Populate Anything // Force Dynamic Population When Editing via Gravity View
<?php
/**
* Gravity Perks // Populate Anything // Force Dynamic Population When Editing via Gravity View
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gravityview/edit_entry/field_value', function( $field_value, $field ) {
// Update "123" to your form ID and "4" to your field ID.
if ( $field->formId == 123 && $field->id == 4 ) {
if ( isset( $GLOBALS['gppa-field-values'] ) ) {
$hydrated_field = gp_populate_anything()->hydrate_field( $field, GFAPI::get_form( $field->formId ), array(), null, false );
@damiencarbery
damiencarbery / wc-defer-order-emails.php
Last active January 9, 2024 15:54
Defer WooCommerce emails for a few minutes - Defer WooCommerce emails for a specified time after the normal delivery time. https://www.damiencarbery.com/2020/04/defer-woocommerce-emails-for-a-few-minutes/
<?php
/*
Plugin Name: Defer WooCommerce emails for a few minutes (use Action Scheduler)
Plugin URI: https://www.damiencarbery.com/2020/04/defer-woocommerce-emails-for-a-few-minutes/
Description: Defer WooCommerce emails for a specified time after the normal delivery time. Use Action Scheduler instead of WP Cron. Call do_action() instead of remove_action() and calling trigger.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.8
*/