Skip to content

Instantly share code, notes, and snippets.

View nickkuijpers's full-sized avatar

Nick Kuijpers nickkuijpers

View GitHub Profile
<?php
$imagearray = wp_get_attachment_image_src( get_post_thumbnail_id(), 'medium' );
?>
<a href="<?php the_permalink(); ?>">
<img class="img-responsive" src="<?php echo $imagearray[0]; ?>">
</a>
@nickkuijpers
nickkuijpers / gist:6a6d19dd6cddb85827fb
Created April 12, 2015 16:49
WooCommerce Cart Info
<a href="<?php echo WC()->cart->get_cart_url(); ?>" class="mini-card-icon">
<?php echo sprintf (_n( '%d', '%d', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?>
</a>
@nickkuijpers
nickkuijpers / gist:18dd4c7f0b23316467ab
Created April 14, 2015 22:09
WooCommerce Change Terms Positions Above Button
.woocommerce #payment #place_order, .woocommerce-page #payment #place_order {
position:relative;
top:80px;
}
#payment .terms {
position:relative;
top:-40px;
}
@nickkuijpers
nickkuijpers / gist:6851e047050f5087ca38
Last active August 29, 2015 14:19
Unyson Get Value
// settings page
$footerid = fw_get_db_settings_option('element');
// get page option
$post_id = get_the_ID();
$o = fw_get_db_post_option($post_id, 'opdrachtgever', $default_value = null);
@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: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: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: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: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:9ef8b5e74b513748712f
Created September 28, 2015 15:10
Contactform 7 On Sent Redirect
on_sent_ok: "location.replace('http://paintballgelderland.nl/boeking-dank-je-wel');"