Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Van Patten chrisvanpatten

View GitHub Profile
View quantity-input.php
<?php
/**
* Product quantity inputs
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
View functions.php
<?php
/**
* vpm_comments_template
*
* Load our own template file for WooCommerce reviews
*/
function vpm_comments_template( $template ) {
global $woocommerce;
$comments_template_path = get_stylesheet_directory() . '/woocommerce/single-product-reviews.php';
View compact-firefox.css
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
#titlebar {
min-height: 36px !important;
}
#nav-bar-customization-target {
padding: 2px 4px;
}
@chrisvanpatten
chrisvanpatten / functions.php
Created Jun 7, 2014
Automatically register sidebars for all pages on a WordPress site
View functions.php
<?php
/**
* Per-page areas
*/
$pages_args = array(
'post_type' => 'page',
'posts_per_page' => -1,
);
@chrisvanpatten
chrisvanpatten / cross-sells.php
Created Jun 7, 2014
Conditional content in WordPress with CFS
View cross-sells.php
<?php
if ( $cfs->get('cross_sells') ) {
// Use the per-page options, if set
$cross_sells = $cfs->get( 'cross_sells' );
$cs_header = $cfs->get( 'cross_sell_header_text' );
} else {
// Use the global setting
$cross_sells = $cfs->get( 'cross_sells', rach5_options() );
$cs_header = $cfs->get( 'cross_sell_header_text', rach5_options() );
@chrisvanpatten
chrisvanpatten / get_mailchimp_dc.php
Created Jun 16, 2014
Get the $dc (datacenter) out of a MailChimp API key with PHP
View get_mailchimp_dc.php
<?php
/**
* get_mailchimp_dc
*
* @return string
*/
function get_mailchimp_dc( $api_key ) {
$dc = 'us1';
$dc = explode('-', $api_key, 2 );
@chrisvanpatten
chrisvanpatten / remove_meta_box.php
Created Jun 21, 2014
Remove a WordPress meta box permanently
View remove_meta_box.php
<?php
/**
* vpm_remove_meta_box
*/
function vpm_remove_meta_box() {
remove_meta_box( 'postcustom', 'post', 'normal' );
}
add_action( 'add_meta_boxes', 'vpm_remove_meta_box' );
@chrisvanpatten
chrisvanpatten / vpmframe-wp.sh
Last active Aug 29, 2015
Automatically create a new wpframe project
View vpmframe-wp.sh
#!/usr/bin/env bash
# Create a vpmframe-wp project
mkdir $1
cd $1
git init
touch vpmframe-wp
View cfs.yml
group:
title: Footer Text
field:
type: text
label: Product Type
name: product_type
options:
formatting: Default
required: false
notes: This can be any string.
@chrisvanpatten
chrisvanpatten / woocommerce-nags.php
Created Apr 23, 2015
Suppress WooCommerce nags
View woocommerce-nags.php
<?php
/**
* Suppress certain WooCommerce admin notices
*/
function suppress_woocommerce_nags() {
if ( class_exists( 'WC_Admin_Notices' ) ) {
// Remove the "you have outdated template files" nag
WC_Admin_Notices::remove_notice( 'template_files' );
You can’t perform that action at this time.