Skip to content

Instantly share code, notes, and snippets.

View thierrypigot's full-sized avatar

Thierry Pigot thierrypigot

View GitHub Profile
@thierrypigot
thierrypigot / index.html
Created December 22, 2015 21:45
Embed external website in full size iframe
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Soref Dictator</title>
<script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
<script>
//function to fix height of iframe!
@thierrypigot
thierrypigot / functions.php
Last active December 23, 2015 09:25
Hook to change map colors for my Beaver plugin.https://github.com/thierrypigot/beaver-builder-googlemaps
function tpbbgmap_custom_map_style( $map_style ) {
$map_style = '[{"featureType":"water","elementType":"geometry","stylers":[{"color":"#e9e9e9"},{"lightness":17}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#f5f5f5"},{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffffff"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#ffffff"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#ffffff"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#ffffff"},{"lightness":16}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#f5f5f5"},{"lightness":21}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#dedede"},{"lightness":21}]},{"elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#ffffff"},{"lightness":16}]},{"ele
@thierrypigot
thierrypigot / functions.php
Created December 23, 2015 09:07
Hook to change map controls for my Beaver plugin.https://github.com/thierrypigot/beaver-builder-googlemaps
function tpbbgmap_custom_map_controls( $controls ) {
$controls['overviewMapControl'] = 'true';
$controls['rotateControl'] = 'true';
$controls['scaleControl'] = 'true';
$controls['scrollwheel'] = 'true';
$controls['width'] = '70%';
return $controls;
}
add_filter( 'bbgmap_map_controls', 'tpbbgmap_custom_map_controls' );
@thierrypigot
thierrypigot / style.css
Created January 19, 2016 09:26
Style placeholder text color
.fl-form-field input[type="text"]::-webkit-input-placeholder { /* Safari, Chrome and Opera */
color: orange;
}
.fl-form-field input[type="text"]:-moz-placeholder { /* Firefox 18- */
color: orange;
}
.fl-form-field input[type="text"]::-moz-placeholder { /* Firefox 19+ */
color: orange;
<?php
//Get current category ID
$categories = get_the_category();
$category_id = $categories[0]->cat_ID;
// OU
// Get children ID of current category
@thierrypigot
thierrypigot / function.php
Last active October 23, 2017 13:05
Shortcode pour afficher la liste des drapeaux Polylang
<?php
add_shortcode('polylang', 'wearewp_shortcode_pll_the_languages');
function wearewp_shortcode_pll_the_languages() {
if( function_exists('pll_the_languages') ) {
global $post;
$args = array(
'show_flags' => 0,
'hide_if_empty' => 0,
@thierrypigot
thierrypigot / username-admin.php
Last active June 10, 2016 16:38
Disallow "admin" as username
<?php
add_filter('validate_username' , 'tp_deny_admin_username', 10, 2);
function tp_deny_admin_username($valid, $username )
{
if( 'admin' == $username ) {
$valid = false;
}
return $valid;
@thierrypigot
thierrypigot / .htaccess
Created April 11, 2016 13:01
Éviter le spam de commentaires dans WordPress
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.presse-citron.net.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
</IfModule>
@thierrypigot
thierrypigot / functions.php
Created April 25, 2016 08:18
Prevent Selected Terms Rising to the Top
<?php
add_filter('wp_terms_checklist_args','tp_wp_terms_checklist_args');
function tp_wp_terms_checklist_args($args) {
$args['checked_ontop'] = false;
return $args;
}
@thierrypigot
thierrypigot / acf-missing.php
Created June 3, 2016 10:13
WordPress mu plugins to check if "Advanced Custom Fields Pro" is active.
<?php
if( !class_exists('acf') )
{
$tp_acf_notice_msg = __( 'This website needs "Advanced Custom Fields Pro" to run. Please download and activate it', 'tp-notice-acf' );
/*
* Admin notice
*/
add_action( 'admin_notices', 'tp_notice_missing_acf' );
function tp_notice_missing_acf()