Skip to content

Instantly share code, notes, and snippets.

View dipakcg's full-sized avatar
🎯
Focusing

Dipak C. Gajjar dipakcg

🎯
Focusing
View GitHub Profile
@dipakcg
dipakcg / wp-config.php
Created September 23, 2018 05:09 — forked from MikeNGarrett/wp-config.php
Disable admin-ajax on the front-end of WordPress sites and cache the resulting 404.
<?php
if(
strpos( $_SERVER['HTTP_REFERER'], 'wp-admin' ) === false &&
strpos( $_SERVER['REQUEST_URI'], 'admin-ajax.php' ) !== false
) {
header( 'Cache-Control: max-age=30000, must-revalidate' );
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', strtotime( '+5000 minutes' ) ) . ' GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', strtotime( '-5000 minutes' ) ) . ' GMT' );
header( $_SERVER["SERVER_PROTOCOL"]." 404 Not Found" );
die;
@dipakcg
dipakcg / functions.php
Created January 3, 2017 08:13 — forked from amdrew/functions.php
Easy Digital Downloads - Start to finish example of 1. Adding a phone number field at checkout 2. Making the phone field required 3. Showing the phone field on the "view order details" screen 4. Adding a new {phone} email tag to show the phone number in either the standard purchase receipt or admin notifications
<?php
/**
* Display phone number field at checkout
* Add more here if you need to
*/
function sumobi_edd_display_checkout_fields() {
// get user's phone number if they already have one stored
if ( is_user_logged_in() ) {
@dipakcg
dipakcg / parallelize.php
Created September 14, 2016 09:22 — forked from leowebguy/parallelize.php
Parallelize downloads across hostnames for WordPress. Useful to boost static resources load speed on websites. Recommended by GTmetrix, Pingdom, Google Speed Insights, and others.
<?php
/******
Parallelize downloads across hostnames for WordPress.
Useful to boost static resources load speed on websites.
Recommended by GTmetrix, Pingdom, Google Speed Insights, and others.
See full post > https://medium.com/p/32e9dc2fec0c
In order to work properly, all subdomains/hostnames MUST have the same structure/path. Ex:
http://mydomain.com/wp-content/uploads/2015/11/myimage.jpg