Skip to content

Instantly share code, notes, and snippets.

View example.php
<?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 / cron-mu-cli.sh
Last active Dec 18, 2016
Run all cron due cron events on multisite
View cron-mu-cli.sh
#!/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
View postmessage.js
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 / filter.php
Created May 22, 2016
Disable Simple Image Sizes featured image regeneration button
View filter.php
<?php
add_filter( 'SIS/Admin/Post/Display_Thumbnail_Regenerate', '__return_false' );
@Rahe
Rahe / class-terms-fields.php
Last active Jan 30, 2018
Load all ACF terms Fields into the term object
View class-terms-fields.php
<?php
/**
* Class ACF_Terms_Fields
* @version 1.1.0
*
* Fill all the taxonomy terms with ACF metas
*/
class ACF_Terms_Fields {
/**
View search-filter.php
<?php
function custom_search_query( $query ) {
if( is_admin() && $query->is_main_query() && $query->query['post_type'] === 'revendeurs' && isset($query->query_vars['s']) )
{
$custom_fields = array(
// put all the meta fields you want to search for here
"raison_sociale",
);
$searchterm = $query->query_vars['s'];
View shortcode-album.php
<?php
/*
Plugin Name: Album shortcode
Version: 0.1
Description: Un shortcode pour afficher un album
*/
// don't load directly
if ( !defined('ABSPATH') )
die('-1');
View shortcode-album.php
<?php
/*
Plugin Name: Album shortcode
Version: 0.1
Description: Un shortcode pour afficher un album
*/
// don't load directly
if ( !defined('ABSPATH') )
die('-1');
View shortcode-album.php
<?php
/*
Plugin Name: Album shortcode
Version: 0.1
Description: Un shortcode pour afficher un album
*/
// don't load directly
if ( !defined('ABSPATH') )
die('-1');
View shortcode-album.php
<?php
/*
Plugin Name: Album shortcode
Version: 0.1
Description: Un shortcode pour afficher un album
*/
// don't load directly
if ( !defined('ABSPATH') )
die('-1');
You can’t perform that action at this time.