Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / filter.php
Created May 22, 2016 08:20
Disable Simple Image Sizes featured image regeneration button
<?php
add_filter( 'SIS/Admin/Post/Display_Thumbnail_Regenerate', '__return_false' );
@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 {
/**
<?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'];
@Rahe
Rahe / shortcode-album.php
Created November 16, 2014 15:08
Shortcode album
<?php
/*
Plugin Name: Album shortcode
Version: 0.1
Description: Un shortcode pour afficher un album
*/
// don't load directly
if ( !defined('ABSPATH') )
die('-1');
@Rahe
Rahe / shortcode-album.php
Created November 16, 2014 15:08
Shortcode album
<?php
/*
Plugin Name: Album shortcode
Version: 0.1
Description: Un shortcode pour afficher un album
*/
// don't load directly
if ( !defined('ABSPATH') )
die('-1');
@Rahe
Rahe / shortcode-album.php
Created November 16, 2014 15:08
Shortcode album
<?php
/*
Plugin Name: Album shortcode
Version: 0.1
Description: Un shortcode pour afficher un album
*/
// don't load directly
if ( !defined('ABSPATH') )
die('-1');
@Rahe
Rahe / shortcode-album.php
Created November 16, 2014 15:08
Shortcode album
<?php
/*
Plugin Name: Album shortcode
Version: 0.1
Description: Un shortcode pour afficher un album
*/
// don't load directly
if ( !defined('ABSPATH') )
die('-1');