Skip to content

Instantly share code, notes, and snippets.

View frankschrijvers's full-sized avatar

WPStudio frankschrijvers

View GitHub Profile
@frankschrijvers
frankschrijvers / masonry-scroll.php
Last active August 29, 2015 14:18
Add custom class to post
// Add custom post class to posts
add_filter('post_class', 'wpstudio_custom_post_class');
function wpstudio_custom_post_class($classes) {
$new_class = 'brick';
$classes[] = esc_attr(sanitize_html_class($new_class));
return $classes;
}
@frankschrijvers
frankschrijvers / masonry-isotope.js
Last active August 29, 2015 14:18
Infinite Scroll Behavior Masonry Integration
/*
--------------------------------
Infinite Scroll Behavior
Masonry Integration
--------------------------------
+ https://github.com/paulirish/infinitescroll/
+ version 2.0b2.110617
+ Copyright 2011 Paul Irish & Luke Shumard
+ Licensed under the MIT license
@frankschrijvers
frankschrijvers / WooCommerce with Genesis
Created April 5, 2015 21:15
WooCommerce Function for the Genesis Framework
function woocommerce_setup_genesis() {
woocommerce_content();
}
@frankschrijvers
frankschrijvers / WooCommerce Template
Created April 5, 2015 21:20
WooCommerce Template page for Genesis Child Theme
<?php
/**
* WooCommerce Template
*
* Template used for all WooCommerce views for your site
*
*/
//* Remove standard post content output
remove_action( 'genesis_loop', 'genesis_do_loop');
@frankschrijvers
frankschrijvers / declare WooCommerce support
Created April 5, 2015 21:22
Declare WooCommerce support
//* Declare WooCommerce Support
add_theme_support( 'woocommerce' );
@frankschrijvers
frankschrijvers / functions.php
Created April 5, 2015 21:44
Declare WooCommerce Support
//* Declare WooCommerce Support
add_theme_support( 'woocommerce' );
@frankschrijvers
frankschrijvers / functions.php
Last active July 17, 2021 04:11
Add WooCommerce mini cart to primary nav Genesis
/**
* Add WooCommerce cart to primary navigation Genesis
* @author Frank Schrijvers
* @link https://www.wpstud.io/add-woocommerce-cart-to-genesis-navigation/
*/
if ( class_exists( 'WooCommerce' ) ) {
add_action( 'genesis_header_right', 'wpstudio_add_cart' );
function wpstudio_add_cart() {
echo '<div class="mini-cart">';
echo '<a href="' . WC()->cart->get_cart_url() .'"title="View your shopping cart">'. WC()->cart->get_cart_total(). '</a>';
@frankschrijvers
frankschrijvers / functions.php
Created April 23, 2015 15:01
Add search to genesis navigation
add_filter( 'wp_nav_menu_items', 'wpstudio_search_primary_nav_menu', 10, 2 );
/**
* @author Frank Schrijvers
* @example https://www.wpstud.io
*/
function wpstudio_search_primary_nav_menu( $menu, stdClass $args ){
if ( 'primary' != $args->theme_location )
return $menu;
@frankschrijvers
frankschrijvers / style.css
Created April 24, 2015 09:14
Basic styling WooCommerce cart Genesis navigation
.mini-cart {
display: block;
float: right;
font-size: 16px;
line-height: 1;
margin-left: 2em;
padding: 30px 24px;
}
.mini-cart .amount {
margin-right: 1em;
@frankschrijvers
frankschrijvers / functions.php
Last active March 17, 2021 05:00
Hide other shipping methods when FREE SHIPPING is available
**
* woocommerce_package_rates is a 2.1+ hook
*/
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
/**
* Hide shipping rates when free shipping is available
*
* @param array $rates Array of rates found for the package
* @param array $package The package array/object being shipped