Skip to content

Instantly share code, notes, and snippets.

View quasel's full-sized avatar
🙃
Don't worry be happy!

Bernhard quasel

🙃
Don't worry be happy!
View GitHub Profile
@quasel
quasel / acf-fields.php
Created December 28, 2015 19:36 — forked from hereswhatidid/acf-fields.php
Create custom product details tabs within WooCommerce using an ACF (Advanced Custom Fields) Repeater field.
<?php
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'acf_product_options',
'title' => 'Product Options',
'fields' => array (
array (
'key' => 'acf_product_options_tabbedcontent_label',
'label' => 'Tabbed Content',
<?php
/**
* @package ThemeName
* @version 0.1.0
* @author Your Name <you@youremailprovider.com>
* @copyright Copyright (c) 2013, Your Name
* @link http://yoursite.com/themes/theme-slug
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@quasel
quasel / isa-check-if-woocommerce-pa-is-tax
Created January 7, 2016 13:47 — forked from isabelc/isa-check-if-woocommerce-pa-is-tax
Check if your WooCommerce custom product attributes are taxonomies. This will show custom product attributes on your product page above the Add to Cart button. THIS WILL ALSO SHOW A NOTICE ON THE PRODUCT PAGE RIGHT UNDER THE ATTRIBUTES. THE NOTICE WILL EITHER SAY: "These ARE taxonomies." or "NOT a taxonomy."
/**
* Check if your WooCommerce custom product attributes are taxonomies.
*
* This will show custom product attributes on your product page
* above the Add to Cart button.
*
* THIS WILL ALSO SHOW A NOTICE ON THE PRODUCT PAGE
* RIGHT UNDER THE ATTRIBUTES.
*
* THE NOTICE WILL EITHER SAY:
@quasel
quasel / move-proceed-to-checkout
Created January 10, 2016 10:20 — forked from BurlesonBrad/move-proceed-to-checkout
Get the friggin' Proceed To Checkout button to the TOP of the page (not the bottom!!)
add_action( 'woocommerce_before_cart', 'move_proceed_button' );
function move_proceed_button( $checkout ) {
echo '<a href="' . esc_url( WC()->cart->get_checkout_url() ) . '" class="checkout-button button alt wc-forward" >' . __( 'Proceed to Checkout', 'woocommerce' ) . '</a>';
}
@quasel
quasel / wc-min-max-price-suffix.php
Created January 25, 2016 01:07 — forked from marketpress-support-team/wc-min-max-price-suffix.php
Streichpreisen in WooCommerce einen Hinweistext hinzufügen: Dieses Mini-Plugin fügt WooCommerce-Produkten mit Streichpreisen einen eigene Hinweistext hinzu, der zu Beginn des Plugin-Codes, innerhalb der Funktion wc_min_max_price_suffix__defaults(), angepasst werden kann. Das Plugin nutzt die filterbare WooCommerce-Option ›Zusatz zur Preisangabe‹…
<?php
/**
* Plugin Name: WooCommerce|Min-Max Price Suffix
* Description: Append custom text to min-max prices in WooCommerce.
* Version: 2015.12
* Author: Caspar Hübinger, Inpsyde
* Author URI: https://marketpress.com
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
add_action( 'woocommerce_flat_rate_shipping_add_rate', 'add_another_custom_flat_rate', 10, 2 );
function add_another_custom_flat_rate( $method, $rate ) {
$new_rate = $rate;
$new_rate['id'] .= ':' . 'custom_rate_name'; // Append a custom ID
$new_rate['label'] = 'Rushed Shipping'; // Rename to 'Rushed Shipping'
$new_rate['cost'] += 2; // Add $2 to the cost
// Add it to WC
$method->add_rate( $new_rate );
<?php
/*
* Add virtual Field Grouping to Pods
* This requires the PR from https://github.com/pods-framework/pods/pull/3548 which will hopefully be
* available in Pods 2.6.6
* James Golovich <james@gnuinter.net>
*/
@quasel
quasel / font-awesome.php
Created July 29, 2016 16:15 — forked from justintadlock/font-awesome.php
PHP array of Font Awesome icons.
<?php
// Font Awesome v. 4.6.
function jt_get_font_icons() {
return array(
'fa-glass' => 'f000',
'fa-music' => 'f001',
'fa-search' => 'f002',
'fa-envelope-o' => 'f003',
@quasel
quasel / add-to-cart.php
Created July 31, 2016 16:36 — forked from lukecav/add-to-cart.php
Display Product Variations in the Shop Loop
<?php
/**
* Loop Add to Cart
*
* This template can be overridden by copying it to yourtheme/woocommerce/loop/add-to-cart.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@quasel
quasel / functions.php
Created August 21, 2016 17:40 — forked from cliffordp/functions.php
How to remove (dequeue) The Events Calendar's and PRO's styles.
<?php
// If you use this snippet as-is, ALL of The Events Calendar (i.e. "Core") and Pro add-on styles will NOT be loaded.
// (although there may be some $handles that I didn't detect... especially from widgets, shortcodes, and the like... no guarantess ;-)
// Comment out the line of each style you DO want to load.
// Note the comments within each array regarding the Display style options -- https://theeventscalendar.com/knowledgebase/wp-admin-settings-overview/#display
// The Display styles are "stacked".
// In other words, the Skeleton files are always loaded, and the Full styles are loaded when Tribe Events Styles (i.e. Theme) is selected.
// However, the commented .css example file names can change, e.g. 'full.min.css' instead of 'skeleton.min.css' or 'theme-mobile.min.css' instead of 'full-mobile.min.css'
//