Skip to content

Instantly share code, notes, and snippets.

View alanpilloud's full-sized avatar

Alan alanpilloud

View GitHub Profile
@alanpilloud
alanpilloud / checkbox.php
Last active January 16, 2021 10:22
PHP ACF Fields
[
// Don't forget required attributes 'key', 'name' and 'label'
'type' => 'checkbox',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => [
'width' => '',
'class' => '',
'id' => '',
@alanpilloud
alanpilloud / .vimrc
Created June 7, 2018 13:07
My Vimrc file
set nocompatible
set t_Co=256
" search and replace on the whole document by default, no need to add "g"
set gdefault
" enable color scheme
syntax on
set background=dark
colorscheme solarized
set cursorline
@alanpilloud
alanpilloud / .htaccess
Last active March 2, 2018 08:45 — forked from seoagentur-hamburg/.htaccess
Optimal .htaccess for WordPress
# ***
# Compression and Cache
# ***
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
@alanpilloud
alanpilloud / geolocation.html
Created February 6, 2017 17:13
Geolocation example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Geolocation with Javascript</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="container">
@alanpilloud
alanpilloud / .vimrc
Created December 22, 2016 15:55
.vimrc file
set t_Co=256
" enable color scheme
syntax on
set background=dark
colorscheme solarized
set cursorline
" show line numbers
set number
@alanpilloud
alanpilloud / theme-widget-documents.php
Created July 25, 2016 11:38
Add admin dashboard widgets for each .md file found in theme root.
<?php
/**
* Add admin dashboard widgets for each .md file found in theme root.
*
* reads the *.md markdown files at the root of the theme and display a widget for each .md in the admin dashboard
* <!> Requires the class Parsedown https://github.com/erusev/parsedown
* <!> includes classes/Parsedown.php
*/
add_action('wp_dashboard_setup', function(){
$themeDir = get_template_directory();
@alanpilloud
alanpilloud / clean-smartcrawl-metabox.php
Created July 22, 2016 12:20
Cleaning Smartcrawl metabox
<?php
/**
* Cleaning Smartcrawl metabox
*/
add_action('admin_head', function() {
echo '
<style>
#wds-wds-meta-box .widefat tr{display:none}
#wds-wds-meta-box .widefat tr:nth-child(1),
#wds-wds-meta-box .widefat tr:nth-child(2),
@alanpilloud
alanpilloud / wp-youtube-embed.php
Last active June 16, 2016 08:01
Embed youtube vidéos #wp
<?php
/**
* Responsive Youtube embeds.
*
* Adds bootstrap responsive embed markup and classes and avoid showing related
* videos at the end of the videos.
*/
add_filter( 'embed_oembed_html', function( $html, $url, $attr, $post_ID ) {
if ( false !== stripos( $html, '<iframe ' ) && false !== stripos( $html, '.youtube.com/embed' ) ) {
//don't show related videos
<!--
Make sure that the viewBox attributes are using the same values.
xlink:href should refer to the id of the <svg> and have a # sign before it.
-->
<div style="display:none">
<svg id="mySVG" width="50" height="50" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">...</svg>
</div>
<svg viewBox="0 0 50 50"><use xlink:href="#mySVG"></use></svg>
<?php
/*
Plugin Name: Bwap Shortcodes
Description: Add shortcodes you write
Version: 0.1
Author: Bwap
*/
defined( 'ABSPATH' ) or die;
/**