Skip to content

Instantly share code, notes, and snippets.

View DanielSantoro's full-sized avatar

Danny Santoro DanielSantoro

View GitHub Profile
@DanielSantoro
DanielSantoro / !custom.txt
Created March 18, 2016 16:01
Custom Snippet
I am sorry to say this customization is not covered under our [Support Policy](http://www.woothemes.com/support-policy). However, we recommend that you contact one of the following services regarding custom development for your site:
* [WooExperts](https://www.woothemes.com/wooexperts/)
* [Codeable](http://codeable.io/?utm_source=ZenDesk&utm_medium=ticket-reply&utm_campaign=Custom%20Referral)
@DanielSantoro
DanielSantoro / !custom.txt
Created March 18, 2016 16:00
Custom Snippet
I am sorry to say this customization is not covered under our [Support Policy](http://www.woothemes.com/support-policy). However, we recommend that you contact one of the following services regarding custom development for your site:
* [WooExperts](https://www.woothemes.com/wooexperts/)
* [Codeable](http://codeable.io/?utm_source=ZenDesk&utm_medium=ticket-reply&utm_campaign=Custom%20Referral)
@DanielSantoro
DanielSantoro / class-wc-cp-display.php
Created March 17, 2016 18:16
Composite Products Terms
<?php
/**
* Composite front-end filters and functions.
*
* @class WC_CP_Display
* @version 3.5.0
* @since 2.2.2
*/
// Exit if accessed directly.
@DanielSantoro
DanielSantoro / ups.xml
Created March 17, 2016 16:07
UPS Response
PACKAGE 1 (0)
stdClass Object
(
[id] =>
[packed] => Array
(
[0] => WC_Boxpack_Item Object
(
[weight] => 0.69
[height] => 0.30
@DanielSantoro
DanielSantoro / footer.php
Created March 15, 2016 19:38
Updating Footer with Year Sample - PC New Horizons
@DanielSantoro
DanielSantoro / functions.php
Created March 11, 2016 21:16
Modified Functions Area
/*-----------------------------------------------------------------------------------*/
/* You can add custom functions below */
/*-----------------------------------------------------------------------------------*/
// Add Login & Logout to Navigation Menu. Found on http://www.pootlepress.com
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == 'primary-menu') {
$items .= '<li><a href="'. wp_logout_url() .'">Log Out</a></li>';
}
@DanielSantoro
DanielSantoro / functions.php
Created March 11, 2016 21:13
Add Login/Logout to Primary Menu for Canvas
// Found on http://www.pootlepress.com
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == 'primary-menu') {
$items .= '<li><a href="'. wp_logout_url() .'">Log Out</a></li>';
}
elseif (!is_user_logged_in() && $args->theme_location == 'primary-menu') {
$items .= '<li><a href="'. site_url('wp-login.php') .'">Log In</a></li>';
}
return $items;
@DanielSantoro
DanielSantoro / bad-functions.php
Created March 11, 2016 21:04
Bad Functions Notation
<?php
/*-----------------------------------------------------------------------------------*/
/* This is a great section header, since it takes space and stands out. */
/*-----------------------------------------------------------------------------------*/
// Note that a line doesn't have a character limit - as long as you don't hit enter/return on your keyboard, one mark will null the entire bit.
/* The same thing goes for this way. */
This line is missing a prefix.
// This one has a prefix, and that line above is going to be a problem.
@DanielSantoro
DanielSantoro / functions.php
Created March 11, 2016 20:50
Canvas Theme Functions
<?php
/*-----------------------------------------------------------------------------------*/
/* Start WooThemes Functions - Please refrain from editing this section */
/*-----------------------------------------------------------------------------------*/
// Set path to WooFramework and theme specific functions
$functions_path = get_template_directory() . '/functions/';
$includes_path = get_template_directory() . '/includes/';
@DanielSantoro
DanielSantoro / functions.php
Created February 18, 2016 16:39
Change No Shipping Method Available Message Conditionally
add_filter( 'woocommerce_cart_no_shipping_available_html', 'change_noship_message', 10, 1 );
add_filter( 'woocommerce_no_shipping_available_html', 'change_noship_message', 10, 1 );
function change_noship_message( $default ) {
$search_shipping_class = 32; // Use Shipping Class ID
$cart_shipping_classes = array();
foreach( WC()->cart->cart_contents as $key => $values )
$cart_shipping_classes[] = $values[ 'data' ]->get_shipping_class_id();
$cart_shipping_classes = array_unique( $cart_shipping_classes );