Skip to content

Instantly share code, notes, and snippets.

View nicomollet's full-sized avatar

Nico Mollet nicomollet

View GitHub Profile
@spivurno
spivurno / gw-gravity-forms-to-wp-job-manager.php
Last active October 25, 2021 20:30
Gravity Wiz // Gravity Forms // Populate GF Data into WP Job Manager Custom Fields
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/experimental/gw-gravity-forms-to-wp-job-manager.php
*/
/**
* Gravity Wiz // Gravity Forms // Populate GF Data into WP Job Manager Custom Fields
*
* Provides support for mapping a GF multiselect field to a WPJM multiselect field.
@SmashBrando
SmashBrando / functions.php
Last active February 5, 2020 16:27
Google Trusted Stores - Woocommerce Thank You Page Output
<?php
add_action( 'woocommerce_thankyou', 'google_trusted_stores_confirmation' );
function google_trusted_stores_confirmation( $order_id ) {
// Lets grab the order
$order = wc_get_order( $order_id );
$customer = get_current_user_id();
@tnottu
tnottu / polylang-bulk-translate.php
Created November 28, 2016 13:06
WP Polylang Bulk Translate
<?php
/*
Plugin Name: Polylang Bulk Translate
Plugin URI:
Version: 0.1.0
Author: Tyomaa Oy
Author URI: https://github.com/tnottu
Description: Translate multiple posts with bulk actions
License: GPLv2 or later
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active January 9, 2025 12:22
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@glueckpress
glueckpress / wp-rocket-clear-additional-urls.php
Last active March 5, 2019 21:16
[WordPress][WP Rocket] Edge case for mapped domains within the same installation. Clears an additional URL from cache when a given URL is cleared.
<?php
/**
* Plugin Name: WP Rocket | Clear Additional URLs
* Description: Clears an additional URL from cache when a given URL is cleared.
* Version: 0.1
* Author: WP Rocket Support Team
* Author URI: http://wp-rocket.me/
* Plugin URI: https://gist.github.com/glueckpress/1c49dde98a361ec043fa
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
@devinsays
devinsays / new-customer-coupon.php
Created January 4, 2016 04:56
Example for WooCommerce unit tests.
<?php
namespace WooCommerce\Tests\New_Customer_Coupon;
/**
* Class New_Customer_Coupon.
* @package WooCommerce\Tests\New_Customer_Coupon
*/
class New_Customer_Coupon extends \WC_Unit_Test_Case {
@herewithme
herewithme / wp-rocket-purge-all.php
Last active August 5, 2024 07:08
Purge all WP rocket cache when a post is modified/edited
<?php
/*
Plugin Name: Purge all WP Rocket cache
Plugin URI: http://www.beapi.fr
Description: Purge all WP rocket cache when a post is modified/edited
Version: 1.0
Author: BeAPI
Author URI: http://www.beapi.fr
Network: true
*/
@renchap
renchap / README.md
Last active February 14, 2025 13:25
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
<?php
add_action( 'wp_enqueue_scripts', 'jt_enqueue_scripts' );
function jt_enqueue_scripts() {
wp_enqueue_script( 'wp-api' );
wp_enqueue_script( 'wp-util' );
}
add_action( 'wp_footer', 'jt_print_post_template', 25 );
@jrnickell
jrnickell / create-project
Last active March 24, 2017 13:22
Nginx server config
#!/usr/bin/env bash
function create_index
{
cat <<- __EOF__
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>$PROJECT</title>