Skip to content

Instantly share code, notes, and snippets.

@Rahe
Rahe / postmessage.js
Created June 17, 2016 13:19
PostMessage
var origin = null;
if(window.addEventListener) {
window.addEventListener('message', onMessage, false);
} else {
window.attachEvent('onmessage', onMessage);
}
function onMessage(e) {
if(referer !== undefined && e.origin === referer) {
@Rahe
Rahe / cron-mu-cli.sh
Last active December 18, 2016 11:28
Run all cron due cron events on multisite
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "You need to pass the url of the site. Usage ./cron-mu-cli.php http://mysite.fr"
exit
fi
for url in $( wp site list --field=url --url=$1 )
do
@Rahe
Rahe / example.php
Created October 26, 2018 15:00
Codeception
<?php
// Create fake resource
$resource = new \StdClass();
$resource->card = new \StdClass();
$resource->card->id = 1;
$resource->card->last4 = '3333';
$resource->card->exp_year = '2019';
$resource->card->exp_month = '01';
$resource->card->brand = 'mastercard';
@Rahe
Rahe / class-terms-fields.php
Last active December 26, 2020 22:31
Load all ACF terms Fields into the term object
<?php
/**
* Class ACF_Terms_Fields
* @version 1.1.0
*
* Fill all the taxonomy terms with ACF metas
*/
class ACF_Terms_Fields {
/**