This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Shortcode Extended | |
* | |
* @package ShortcodeExtended | |
* @author Chris Sparshott | |
* @copyright 2022 Chris Sparshott | |
* @license GPL-2.0-or-later | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// The field accepts a value with this structure | |
$value = [ | |
'address' => '123 Example St, Townsville XYZ 1234, Country', | |
'lat' => - 38.1486228, | |
'lng' => 144.360414, | |
'zoom' => 14, | |
'place_id' => 'Ei0xMjMgTW9vcmFib29sIFN0LCBHZWVsb25nIFZJQyAzMjIwLCBBdXN0cmFsaWEiMBIuChQKEgmX0JaIHBTUahFyH_LC9sYD8hB7KhQKEglDz-DYDxTUahECZY8QisCjzg', | |
'street_number' => 123, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function modify_woo_ticket_headers( $headers, $id ) { | |
remove_filter( 'woocommerce_email_headers', 'modify_woo_ticket_headers' ); | |
$organizer_email = tribe_get_organizer_email( $id, false ); | |
// add organizer email if it's a valid email address | |
if ( is_email( $organizer_email ) ) { | |
$headers[] = sprintf( 'Cc: %s', $organizer_email ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter for GravityForms to group select field choices by a special "optgroup" choice. | |
* | |
* Simply add a new choice with a value of 'optgroup' to the dropdown to start a group of options. | |
* All following choices will be grouped under it using its label for the group. | |
* Any number of groups can be created, as each optgroup choice will start a new group. | |
* Supports field placeholder & ungrouped options, but must be before the first group. | |
* | |
* This snippet can be added to your theme's functions.php, or a custom plugin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Insert a value or key/value pair after a specific key in an array. If key doesn't exist, value is appended | |
* to the end of the array. | |
* | |
* @param array $array | |
* @param string $key | |
* @param array $new | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function array_size($arr) { | |
$byte = 0; | |
foreach ($arr as $key => $val) { | |
$byte += is_array($val) ? array_size($val) : mb_strlen($val); | |
} | |
$kb = number_format($byte / 1024, 4); | |
$mb = number_format($byte / 1048576, 4); | |
$gb = number_format($byte / 1073741824, 4); | |
$result = array('Bytes: ' => $byte, 'Kilobytes: ' => $kb, 'Megabytes: ' => $mb, 'Gigabytes: ' => $gb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Given table 'zipcodes' with columns: | |
zipcode, latitude, longitude. | |
Find zipcodes within radius from given zipcode. | |
EXAMPLE: | |
Coordinates for zip 91326 and radius 25 mi: | |
*/ | |
SET @location_lat = 34.2766, | |
@location_lon = -118.544; | |
SELECT zipcode, ( 3959 * acos( cos( radians(@location_lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(@location_lon) ) + sin( radians(@location_lat) ) * sin( radians( latitude ) ) ) ) AS distance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Intro: | |
Here are some export examples you can use to export Sabai directory data. I'm no MySQL expert and there's probably better ways to run these queries but this worked for my purposes. I hope this helps! | |
Note, this is going to export all columns and you'll need to manually go in and remove columns you don't need in Excel or Numbers or whatever spreadsheet program you have. | |
Usage: | |
This is meant to be run in phpMyAdmin. Look at your own table structure and modify as necessary for any custom fields, table prefix, and custom bundle. Custom fields are storedin their own tables and cross linked via entity_id which is the id of a listing. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Integrate Imager.js with WordPress | |
* | |
* Imager.js is BBC's solution for serving responsive and retina images, without | |
* the double payload issues that affect other solutions. For more information: | |
* | |
* https://github.com/BBC-News/Imager.js/ | |
* | |
* This collection of functions modifies the output of WordPress's |
NewerOlder