Skip to content

Instantly share code, notes, and snippets.

View alanpilloud's full-sized avatar

Alan alanpilloud

View GitHub Profile
@alanpilloud
alanpilloud / cron-example.php
Last active June 16, 2016 08:02
This is how I add a cron action in a WordPress Plugin #wp
<?php
/*
Plugin Name: My Cronjobs
*/
defined('ABSPATH') or die;
/**
* Add Cron when the theme is activated
*/
@alanpilloud
alanpilloud / svg-sprite.md
Last active January 4, 2016 13:37
Faire un sprite avec SVG-Sprite
svg-sprite --si --stack icons/*.svg
<?php
class MyConfig extends Config
{
public function __construct()
{
$faker = Faker\Factory::create('en_GB');
$this->post_type = 'post';
$this->post_title = $faker->name();
@alanpilloud
alanpilloud / wp-config.php
Last active November 7, 2016 10:58
usefull config options #wp
<?php
define('DISALLOW_FILE_EDIT', true);
define('WP_DEBUG', true);
define('WP_AUTO_UPDATE_CORE', false);
define('WP_POST_REVISIONS', false );
if ( WP_DEBUG ) {
define( 'WP_DEBUG_LOG', true ); //Log errors in a file
define( 'WP_DEBUG_DISPLAY', false ); //blocks message display on the website
define('SAVEQUERIES', true); //Save MySql queries in the global var $wpdb->queries
@alanpilloud
alanpilloud / minify_html
Last active August 29, 2015 14:22
Minify HTML output
<?php
/*
* Will minify HTML
*/
ob_start(function($b){return preg_replace(['/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s'],['>','<','\\1'],$b);});
?>