Skip to content

Instantly share code, notes, and snippets.

@VanLuda
VanLuda / functions.php
Created September 26, 2019 03:24 — forked from corsonr/functions.php
WooCommerce Stripe: force customer creation in Stripe
<?php // Do not include this if already open! Code goes in theme functions.php.
/*
* Force customer creation process in Stripe.
*/
add_filter( 'wc_stripe_force_save_source', '__return_true' );
@VanLuda
VanLuda / Google Autocomplete Address Form for Formidable Limit by Country
Created March 18, 2017 00:30
Google Autocomplete Address Form for Formidable Limit by Country
<script>
// This example displays an address form, using the autocomplete feature
// of the Google Places API to help users fill in the information.
// This example requires the Places library. Include the libraries=places
// parameter when you first load the API. For example:
// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">
var placeSearch, autocomplete;
var componentForm = {
@VanLuda
VanLuda / install-comodo-ssl-cert-with-serverpilot.rst
Last active March 30, 2018 15:46 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with ServerPilot.

Setting up a SSL Cert from Comodo with ServerPilot

I use Google Domains as a registrar, DigitalOcean.com for hostings and Comodo for SSL Certs.

These are the steps I went through to set up an SSL cert.

Purchase the cert

// Block Non-Admins from Accessing Dashboard
function blockusers_init() {
if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
wp_redirect( home_url() );
exit;
}
}
add_action( 'init', 'blockusers_init' );
//Remove query strings from static resources
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
// Use Google Hosted jQuery
function modify_jquery() {
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', false, '1.12.4');
wp_enqueue_script('jquery');
}
}
add_action('init', 'modify_jquery');
@VanLuda
VanLuda / Google Autocomplete Address Form for Formidable
Created April 30, 2016 07:11
Google Autocomplete Address Form for Formidable
<script>
// This example displays an address form, using the autocomplete feature
// of the Google Places API to help users fill in the information.
// This example requires the Places library. Include the libraries=places
// parameter when you first load the API. For example:
// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">
var placeSearch, autocomplete;
var componentForm = {
@VanLuda
VanLuda / Change Comment Links to Disqus
Last active March 20, 2016 06:18
Changes links on blog post beginning of Disqus comments.