Skip to content

Instantly share code, notes, and snippets.

View LiamBailey's full-sized avatar
💭
Build With Heart - Codeable.io

Liam Bailey LiamBailey

💭
Build With Heart - Codeable.io
View GitHub Profile
protected function get_location_select_html( $object_id, $chosen_location = null, $product = null ) {
$object_type = $this->get_object_type();
$enhanced_search = $this->use_enhanced_search();
$field_name = wc_local_pickup_plus_shipping_method()->is_per_item_selection_enabled() ? '_pickup_location_id' : '_shipping_method_pickup_location_id';
if ( $using_single_location = $this->get_product_pickup_location( $product ) ) {
$chosen_location = $using_single_location;
$using_single_location = true;
} elseif ( ! $chosen_location ) {
<div id="stat-wrapper">
<?php if ( have_rows( 'stats' ) ) : ?>
<?php $showitems = 2; $i = 0;$maincount = 0; ?>
<div class="col">
<?php while ( have_rows( 'stats' ) ) : the_row(); ?>
<div class="stat stat-<?php echo $maincount; ?>">
<?php if ( get_sub_field( 'stat_icon' ) ) { ?>
<img src="<?php the_sub_field( 'stat_icon' ); ?>" />
<?php } ?>
<?php the_sub_field( 'stat_headline' ); ?>
<?php
add_filter( 'woocommerce_bookings_in_date_range_query', 'wswp_filter_check_in_cart', 100, 1);
function wswp_filter_check_in_cart( $booking_ids ) {
foreach( $booking_ids as $key => $booking_id ) {
$booking = get_wc_booking( $booking_id );
if ( $booking->has_status( 'in-cart' ) ) {
unset( $booking_ids[$key] );
}
jQuery(function($) {
var beforeButton = $("<i class='incr-button fa fa-minus-circle fa-2x' />");
var beforeButtonClick = function() {
var input = $(this).next();
input.val(new Number(input.val()) - 1);
}
var afterButton = $("<i class='incr-button fa fa-plus-circle fa-2x' />");
var afterButtonClick = function() {
var input = $(this).prev();
input.val(new Number(input.val()) + 1);
@LiamBailey
LiamBailey / wordpress-plugin-svn-to-git.md
Created December 2, 2016 13:40 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
add_action('init','run_my_query');
function run_my_query() {
$todays_date = date("Y-m-d");
if (get_transient("_query_run_".$todays_date))
return;
set_transient("_query_run_".$todays_date,24 * HOUR_IN_SECONDS);
global $wpdb;
$query = "UPDATE wp_2_posts SET menu_order = '9999999' where id in (SELECT DISTINCT tr.object_id FROM wp_2_terms t, wp_2_term_taxonomy tt, wp_2_term_relationships tr WHERE (t.term_id = tt.term_id) AND (tt.term_taxonomy_id = tr.term_taxonomy_id) AND t.term_id = 1440)";
@LiamBailey
LiamBailey / script.js
Created March 17, 2016 20:30
Woocommerce ID Numbers
jQuery(function($) {
$("a.add_to_cart_button").after("<span class='item_cost_holder'></span>");
$(".single_add_to_cart_button").after("<span id='item_cost_holder'></span>");
$(".summary form.cart .quantity").remove();
$(".wswp_id_numbers_field").keypress(function(event) {
if ( $(this).closest('li').find(".add_to_cart_button").length > 0) {
$(this).closest('li').find(".add_to_cart_button").hide();
}
if(event.which != 8 && event.which != 32 && isNaN(String.fromCharCode(event.which))){
event.preventDefault(); //stop character from entering input
<?php
/**
* Plugin Name: Woocommerce Vendors Bookings Management
* Description: Allows vendors to manage their bookings in the frontend
* Version: 1.0.0
* Author: Liam Bailey
* Author URI: http://webbyscots.com/
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
@LiamBailey
LiamBailey / Woocommerce Bookings Dropdown + handles Resources
Created March 10, 2016 18:29
Changes date-picker fields for dropdown of available dates, and refreshes dropdown if resource dropdown is changed
<?php
/*
Plugin Name: Woocommerce Bookings Dropdown
Description: Swaps the date picker for a dropdown of dates
Version: 1.0.0
Author: Webby Scots
Author URI: http://webbyscots.com/
*/
add_action('wp_ajax_wswp_refresh_dates','wswp_refresh_dates');
add_action('wp_ajax_nopriv_wswp_refresh_dates','wswp_refresh_dates');