Skip to content

Instantly share code, notes, and snippets.

View chrisvanpatten's full-sized avatar

Chris Van Patten chrisvanpatten

View GitHub Profile
<?php
/**
* Product quantity inputs
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?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';
@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 June 7, 2014 18:31
Automatically register sidebars for all pages on a WordPress site
<?php
/**
* Per-page areas
*/
$pages_args = array(
'post_type' => 'page',
'posts_per_page' => -1,
);
@chrisvanpatten
chrisvanpatten / cross-sells.php
Created June 7, 2014 18:37
Conditional content in WordPress with CFS
<?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 June 16, 2014 14:03
Get the $dc (datacenter) out of a MailChimp API key with 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 June 21, 2014 19:51
Remove a WordPress meta box permanently
<?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 August 29, 2015 14:04
Automatically create a new wpframe project
#!/usr/bin/env bash
# Create a vpmframe-wp project
mkdir $1
cd $1
git init
touch vpmframe-wp
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 / yoast-nags.php
Created April 23, 2015 16:33
Suppress Yoast WordPress SEO Nags
<?php
/**
* Filter the WP SEO options so we can suppress nags and notices
*
* @param $options array The array of options
* @return array The modified array of options
*/
function filter_yst_wpseo_options( $options ) {
// Suppress the About page