Skip to content

Instantly share code, notes, and snippets.

View nickkuijpers's full-sized avatar

Nick Kuijpers nickkuijpers

View GitHub Profile
@nickkuijpers
nickkuijpers / gist:348697fd344d11c8af67
Created October 19, 2015 17:22
Unyson save as custom field
'save-in-separate-meta' => true,
@nickkuijpers
nickkuijpers / gist:9ef8b5e74b513748712f
Created September 28, 2015 15:10
Contactform 7 On Sent Redirect
on_sent_ok: "location.replace('http://paintballgelderland.nl/boeking-dank-je-wel');"
function custom_search_query( $query ) {
$custom_fields = array(
// put all the meta fields you want to search for here
"fw_options",
);
$searchterm = $query->query_vars['s'];
// we have to remove the "s" parameter from the query, because it will prevent the posts from being found
$query->query_vars['s'] = "";
@nickkuijpers
nickkuijpers / gist:1b74118796af7c81ae96
Created July 14, 2015 19:47
Bulk Add Domains To DirectAdmin
<?php
/**
* Adding domains to DirectAdmin
*/
include 'httpsocket.php';
// domains comma seperated
$domains = 'domein1.nl,domein2.nl,domein3.nl';
@nickkuijpers
nickkuijpers / gist:58ac5910c97a8c5debf1
Created July 12, 2015 23:17
xmlrpc.php ddos solution
# XML-RPC DDoS PROTECTION
<FilesMatch "^(xmlrpc\.php)">
Order Deny,Allow
Deny from all
</FilesMatch>
# XML-RPC DDoS & TRACKBACK/PINGBACK PROTECTION
# Also block Pingbacks and Trackbacks
<FilesMatch "^(xmlrpc\.php|wp-trackback\.php)">
Order Deny,Allow
Deny from all
@nickkuijpers
nickkuijpers / gist:83808c55b64ed29192ca
Created May 21, 2015 22:07
WordPress Unyson Build With Builder
$buildwith = fw_ext_page_builder_is_builder_post( get_the_ID() );
if($buildwith == 1){
the_content();
}
@nickkuijpers
nickkuijpers / gist:f05653ef049f0bd1a5ea
Last active August 29, 2015 14:20
WooCommerce Add Amount Per Page
$value = $_POST['woocommerce-sort-by-columns'];
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return ' . $value . ';' ), 20 );
function woocommerce_catalog_page_ordering($value) {
$amounts = array(
20,
30,
80,
160,
@nickkuijpers
nickkuijpers / gist:7085ecf5670685a9cb9c
Created April 20, 2015 15:03
Wordpress Speed Caching
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@nickkuijpers
nickkuijpers / gist:84d4a93c363ac5c5f2d0
Last active August 29, 2015 14:19
WooCommerce Auto Complete Orders After Payment Received
/**
* Auto Complete all WooCommerce orders.
* Add to theme functions.php file
*/
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order', 1, 1 );
function custom_woocommerce_auto_complete_order( $order_id ) {
global $woocommerce;
if ( !$order_id )
@nickkuijpers
nickkuijpers / gist:9a7cfca7cc7f606af143
Created April 17, 2015 16:53
WooCommerce Extra E-mail Notification
add_filter( 'woocommerce_email_headers', 'add_bcc_to_wc_admin_new_order', 10, 3 );
function add_bcc_to_wc_admin_new_order( $headers = '', $id = '', $wc_email = array() ) {
if ( $id == 'customer_completed_order' ) {
$headers .= "Bcc: [email protected]\r\n"; // replace [email protected] with your email
}
return $headers;
}