Skip to content

Instantly share code, notes, and snippets.

@CNick
CNick / collage.css
Created January 10, 2018 01:28
CSS for custom image collage page template
.collage {
background: #fff url(../images/hero-img.jpg) no-repeat center center;
background-size: cover;
height: 200px;
padding: 0;
}
.collage-wrap a {
text-decoration: none;;
}
/* sm */
@CNick
CNick / page-collage.php
Created January 10, 2018 01:16
Custom full page image collage using the ACF plugin for the image fields.
<?php
/**
* Template Name: Collage Page Template
*
* @package yourweblayout
*/
get_header(); ?>
</div><!-- .container -->
@CNick
CNick / gf-limit-checkboxes.php
Created January 10, 2018 01:14
Custom plugin to limit how many checkboxes can be checked for some fields on content submission forms.
<?php
/*
Plugin Name: Gravity Forms Limit Selected Checkboxes
Plugin URI: http://gravitywiz.com/2012/06/11/limiting-how-many-checkboxes-can-be-checked
Description: Custom plugin to limit how many checkboxes can be checked for some fields on content submission forms. No interface provided. Manually edit plugin code to add or remove fields to limit. Created from this code: http://gravitywiz.com/2012/06/11/limiting-how-many-checkboxes-can-be-checked
Version: 1.0
Author: Christi Nickerson
Author URI: http://cnickerson.com
License: GPL2
*/
@CNick
CNick / Quantity Field in Category
Last active January 9, 2018 19:58
Add Quantity field for simple products on category page
//Add Quantity field for simple products on category page
add_filter( 'woocommerce_loop_add_to_cart_link', 'quantity_inputs_for_woocommerce_loop_add_to_cart_link', 10, 2 );
function quantity_inputs_for_woocommerce_loop_add_to_cart_link( $html, $product ) {
if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) {
$html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">';
$html .= woocommerce_quantity_input( array(), $product, false );
$html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>';
$html .= '</form>';
}
/*
** Reposition WooCommerce breadcrumb
** Adjust array as needed to wrap breadcrumb & change delimiter
*/
add_action( 'init', 'jk_remove_wc_breadcrumbs' );
function jk_remove_wc_breadcrumbs() {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}
/* Replace Shipping with Delivery on cart & checkout pages */
/* Hide Shipping table heading */
table.shop_table_responsive tbody .shipping th,
.shipping th {
visibility: hidden;
}
/* Insert Delivery */
.shipping th:before {
/*
* Enqueue Google fonts
* Replace font link as needed for different fonts.
* Get the fonts link from Google after adding font family (or families)
* and selecting the font weights and styles.
*/
add_action( 'wp_enqueue_scripts', 'prefix_scripts_styles' );
function prefix_scripts_styles() {
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Open+Sans:400,400i,600,600i,700,700i|Roboto:400,400i,500,500i,700,700i', array(), '1.3.1' );
@CNick
CNick / Custom category.php for DSWI
Last active January 10, 2018 01:38
Custom category.php file for DSWI ADS site. Wireframe can be viewed here: http://cnickerson.com/wireframe/category-wireframe.png
<?php
/**
* The archive template file.
*
* WARNING: This template file is a core part of the
* Theme Blvd WordPress Framework. It is advised
* that any edits to the way this file displays its
* content be done with via hooks, filters, and
* template parts.
*
@CNick
CNick / Add link to WP password reset email - sans angled brackets
Last active May 8, 2018 09:51
Some email clients do not work well with angled brackets around links - which is the default format. This snippet will add another link to the password reset email without the angled brackets.