Skip to content

Instantly share code, notes, and snippets.

View klihelp's full-sized avatar
🎯
Focusing on life and money farm

klihelp

🎯
Focusing on life and money farm
View GitHub Profile

Regarding property ordering, I have to disagree that alphabetical is the sensible route. My ordering might seem strange, but the properties are grouped and ordered by relation to one another. Given the following example:

.element {
  box-sizing: content-box;
  color: blue;
  display: block;
  font-family: "Open Sans", sans-serif;
  font-size: 13px;
  font-style: italic;
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
function is_product_eligible( $eligible, $product, $discounter_name, $discounter_object ) {
remove_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
if ( $product->is_on_sale() ) {
$eligible = false;
}
add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
if ( ! is_shop() && ! is_product_taxonomy() ) {
$quantity_field = woocommerce_quantity_input( array(
'input_name' => 'product_id',
'input_value' => ! empty( $product->cart_item['quantity'] ) ? $product->cart_item['quantity'] : 0,
'max_value' => $product->backorders_allowed() ? '' : $product->get_stock_quantity(),
'min_value' => 0,
), $product, false );
$quantity_field = str_replace( array( '<div class="quantity">', "</div>" ), '', $quantity_field );
echo str_replace( '<input ', '<input style="max-width: 70px" ', $quantity_field );
add_action( 'manage_wc_booking_posts_custom_column', 'wc_custom_bookings_columns', 3 );
function wc_custom_bookings_columns( $column ) {
global $post, $booking;
if ( empty( $booking ) || $booking->id != $post->ID ) {
$booking = get_wc_booking( $post->ID );
}
switch ( $column ) {
case 'customer':
@woogist
woogist / product-searchform.php
Created April 13, 2015 07:30
product-searchform.php
<form role="search" method="get" class="woocommerce-product-search" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label class="screen-reader-text" for="s"><?php _e( 'Search for:', 'woocommerce' ); ?></label>
<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search Products&hellip;', 'placeholder', 'woocommerce' ); ?>" value="<?php echo get_search_query(); ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label', 'woocommerce' ); ?>" />
<input type="submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'woocommerce' ); ?>" />
<input type="hidden" name="post_type" value="product" />
</form>
@woogist
woogist / Remove field
Created April 8, 2015 16:10
InterFax Integration: Remove Fax field on checkout page
<?php
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_fax']);
return $fields;
}
@MindyPostoff
MindyPostoff / add-to-cart.php
Created April 6, 2015 14:42
Override loop template and show quantities next to add to cart buttons
<?php
/**
* Loop Add to Cart
*/
global $product;
if( $product->get_price() === '' && $product->product_type != 'external' ) return;
?>
@aamnah
aamnah / google_api_qrcode.php
Created April 4, 2015 10:05
Generate a QR code using Google Charts API
<?php
// Source: http://stackoverflow.com/questions/5943368/dynamically-generating-a-qr-code-with-php
// Google Charts Documentation: https://developers.google.com/chart/infographics/docs/qr_codes?csw=1#overview
// CHart Type
$cht = "qr";
// CHart Size
$chs = "300x300";
@yoren
yoren / content.html
Last active December 4, 2015 10:44
Adding Slick Carousel To Your AngularJS WordPress Theme
<h1 ng-bind-html="post.title"></h1>
<slick dots="true" autoplay="true" slides-to-show="1" slides-to-scroll="1" init-onload="true" data="media" style="width:300px">
<div ng-if="image.is_image" ng-repeat="image in media">
<img alt="{{image.title}}" ng-src="{{image.attachment_meta.sizes.medium.url}}" />
</div>
</slick>
<div ng-bind-html="post.content"></div>
@flesler
flesler / index.html
Last active September 11, 2021 13:16
Anchor navigation powered by jquery.scrollTo
<!-- Include jQuery from somewhere, must use version 1.8 or above -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include latest jquery.scrollTo, can download from https://github.com/flesler/jquery.scrollTo/releases -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script>
<!-- Initialize the plugin, the contents of the script can be inlined here, of course -->
<script type="text/javascript" src="js/init.js"></script>