Skip to content

Instantly share code, notes, and snippets.

View cjwd-snippets's full-sized avatar

cjwd-snippets

View GitHub Profile
@cjwd-snippets
cjwd-snippets / grid.scss
Created February 16, 2019 16:25
CSS Grids using minmax
$col: calc((1200px - (11 * 10px)) / 12); // ($wrapperWidth - ($numberOfGutters * $gutterWidth)) / $numberOfColumns
.grid {
display: grid;
}
.grid-12 {
display: grid;
grid-template-columns: minmax(20px, 1fr) repeat(12, minmax(auto, $col)) minmax(20px, 1fr);
grid-gap: 10px;
@cjwd-snippets
cjwd-snippets / caribbeanmiles.json
Created March 5, 2018 21:26
Base miles for caribbean country pairs
[
{
"Origin": "Antigua",
"Destination": "Barbados",
"Base Miles": "831"
},
{
"Origin": "Antigua",
"Destination": "Grenada",
"Base Miles": "831"
@cjwd-snippets
cjwd-snippets / is_piklist_activated.php
Created September 29, 2017 16:45
Check if piklist is activated
/**
* This plugin depends on Piklist
*
* Is the piklist plugin activated?
*
* @since 1.0.0
*/
public function is_piklist_activated() {
if( is_admin() ) {
@cjwd-snippets
cjwd-snippets / template-hooks.php
Created August 15, 2017 18:19
WooCommerce: Hides checkout fields based on the products in the cart
/**
* Hides checkout fields based on the products in the cart
*
* @param array $fields
* @return array
*/
function conditional_checkout_fields_products( $fields ) {
$cart = WC()->cart->get_cart();
foreach ( $cart as $item_key => $values ) {
@cjwd-snippets
cjwd-snippets / .gitignore
Created July 24, 2017 15:10
Gitignore for Siteground
*~
.DS_Store
.svn
.cvs
*.bak
*.swp
Thumbs.db
# wordpress specific
wp-config.php
@cjwd-snippets
cjwd-snippets / readme.md
Created March 9, 2017 15:58
Starter readme file for my WordPress themes

General Information

This project uses the Gitflow Worflow.

You can learn more here

There are two branches Master and Dev. You will only need to concern yourself with the Dev branch.

The Dev branch will be used to integrate all the themes changes/features.

Getting Started

@cjwd-snippets
cjwd-snippets / extras.php
Last active December 13, 2016 21:47
Function to print sage's main and base templates
<?php
use Vault\Sage\Wrapper;
function sage_wrap_info() {
$format = '<h6>The %s template being used is: %s</h6>';
$main = Wrapper\SpringWrapping::$main_template;
global $template;
printf($format, 'Main', $main);
@cjwd-snippets
cjwd-snippets / redirect-to-custom-login-page
Created September 20, 2016 17:04
Redirects wp-login.php to custom login page
add_action('init', 'studious_redirect_to_custom_login');
function studious_redirect_to_custom_login() {
$login_page = home_url('/login/');
$page = basename($_SERVER['REQUEST_URI']);
if( $page == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
wp_redirect($login_page);
exit;
}
}
@cjwd-snippets
cjwd-snippets / class-pluginname-loader
Created July 31, 2016 17:01
Register all actions,filters and shortcodes for the plugin
<?php
/**
* Register all actions and filters for the plugin
*
* @link http://chinarajames.com
* @since 1.0.0
*
* @package Studiousapp_Notes
* @subpackage Studiousapp_Notes/includes
/*------------------------------------*\
#SHOW-HIDE
\*------------------------------------*/
.hide, .screen-reader-text { @include hide(); }
@include media-query(palm) {
.hide-palm { @include hide(); }
}