Skip to content

Instantly share code, notes, and snippets.

View barbareshet's full-sized avatar
🎯
Focusing

ido barnea barbareshet

🎯
Focusing
View GitHub Profile
@gregrickaby
gregrickaby / html5-schema.org-markup.html
Last active August 2, 2022 00:05
Proper SCHEMA.ORG markup
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noodp, noydir" />
<link rel="dns-prefetch" href="//cdnjs.cloudflare.com">
<link rel="canonical" href="http://mysite.com/" />
<link rel="stylesheet" href="http://mysite.com/style.css" type="text/css" />
@justincarroll
justincarroll / bootstrap-masonry-template.htm
Last active August 15, 2020 16:48
This is my template for using Masonry 3 with Bootstrap 3. For those of you who follow this gist a lot has changed since Bootstrap 2.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Masonry Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700">
@alana-mullen
alana-mullen / Detect the last post in the WordPress loop
Last active May 29, 2023 16:50
Detect the last post in the WordPress loop
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>
@ChromeOrange
ChromeOrange / gist:9559252
Created March 14, 2014 23:33
Deactivate Flat Rate Shipping if products with specific shipping classes are in the cart
/**
* Deactivate Flat Rate Shipping if products with specific shipping
* classes are in the cart
*
* Add the shipping class slugs to the $shippingclass_array array
*/
add_filter( 'woocommerce_shipping_flat_rate_is_available', 'unset_woocommerce_shipping_methods_flat_rate', 10 ,2 );
function unset_woocommerce_shipping_methods_flat_rate ( $return, $package ) {
// Setup an array of shipping classes that do not allow Flat Rate Shipping
@ChromeOrange
ChromeOrange / functions.php
Last active May 7, 2020 22:50
Set a minimum order value for WooCommerce - requires 2.1 or higher
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
// Set this variable to specify a minimum order value
$minimum = 50;
if ( WC()->cart->total < $minimum ) {
if( is_cart() ) {
@ChromeOrange
ChromeOrange / gist:56ce4571836429af330d
Created October 12, 2014 14:54
Set a maximum shipping cost for WooCommerce, add this to functions.php - works with all shipping methods
/**
* Set maximum shipping cost in WooCommerce
*/
add_filter( 'woocommerce_package_rates' , 'woocommerce_set_maximum_shipping_cost', 10, 2 );
function woocommerce_set_maximum_shipping_cost( $rates, $package ) {
foreach( $rates as $rate ) {
// Change 10 to your maximum shipping cost
if( $rate->cost > 10 ) {
$rate->cost = 10;
@ChromeOrange
ChromeOrange / gist:9f0870cf034de287bbb4
Created November 14, 2014 07:17
Unset WooCommerce Free Shipping if certain products are in the cart
/**
* Check the cart for specific products, remove Free Shipping method if they are present
*
* Add the code to your theme functions.php file
*/
add_filter( 'woocommerce_package_rates', 'unset_free_shipping_method' , 10, 2 );
function unset_free_shipping_method( $rates, $package ) {
/**
* Setup an array or products
@hans2103
hans2103 / snippet-bs3-carousel.html
Last active December 12, 2016 10:32
Bootstrap 3 Carousel with Modal popup for NoNumber Snippets in combination with User Agent Detector, NoNumber Sourcerer and NoNumber Articles Anywhere. use: {snippet carousel|category-alias}
@ChromeOrange
ChromeOrange / gist:33af495f6afdd5d7a397
Created February 3, 2015 11:41
Set a minimum order amount in WooCommerce and disable checkout page if it is not met
add_action( 'woocommerce_check_cart_items', 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
// Set this variable to specify a minimum order value
$minimum = 50;
if ( WC()->cart->total < $minimum ) {
WC()->add_error( sprintf( 'You must have an order with a minimum of %s to place your order, your current order total is %s.' ,
woocommerce_price( $minimum ),
@hans2103
hans2103 / .htaccess-mod_headers
Created April 13, 2015 08:33
.htaccess rules to set cache control.
<IfModule mod_headers.c>
Header set Connection keep-alive
# Cache-control headers
# 2 HOURS
#<filesMatch "*">
Header set Cache-Control "max-age=7200, must-revalidate"
#</filesMatch>
# 480 weeks - 290304000