Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / tabs.php
Created Sep 18, 2020 — forked from jmccole83/tabs.php
Add the below file to yourtheme/woocommerce/single-product/tabs/tabs.php. This will update the tabs to be an accordion. Update as required.
View tabs.php
<?php
/**
* Single Product tabs
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/tabs/tabs.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
@jasperf
jasperf / class-walker-nav-menu.php
Created Sep 14, 2020 — forked from ezetojo/class-walker-nav-menu.php
Tailwind Navigation Implementation for Wordpress
View class-walker-nav-menu.php
<?php
/**
* Nav Menu API: Walker_Nav_Menu class
*
* @package WordPress
* @subpackage Nav_Menus
* @since 4.6.0
*/
/**
@jasperf
jasperf / delete_git_submodule.md
Last active May 31, 2020 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.
View delete_git_submodule.md

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule <name>"
  • Delete the now untracked submodule files rm -rf path_to_submodule
@jasperf
jasperf / rcWidget.js
Created May 19, 2020 — forked from milesw/rcWidget.js
rcWidget.js
View rcWidget.js
import 'core-js/es6/array';
import 'core-js/es6/object';
import 'core-js/es6/string';
// Global options
import defaults from './_config';
// general helper functions
import Helper from './_helpers';
// general pricing and currency functions
import Pricing from './_pricing';
// throttle and debounce manager
View Configurations for Laravel app on Kubernetes - Dockerfile
FROM php:7.2-fpm
COPY app /var/www/
EXPOSE 9000
@jasperf
jasperf / woocommerce-single-product-page-price-display-excl-vat-per-role.php
Last active Feb 26, 2020
WooCommerce Single Product Page Price Display Excl VAT per Role
View woocommerce-single-product-page-price-display-excl-vat-per-role.php
/// Display Excluding VAT for role bedrijf on single product page
function edit_price_display() {
global $product;
if(is_singular('product') && is_user_logged_in() && current_user_can( 'bedrijf' )) {
$price = $product->price;
$price_excl_tax = $price + round($price / ( 21 / 100 ), 2);
$price_excl_tax = number_format($price_excl_tax, 2, ",", ".");
$price = number_format($price, 2, ",", ".");
$display_price = '<span class="price">';
@jasperf
jasperf / wp-config-debug.php
Created Feb 19, 2020 — forked from jrfnl/wp-config-debug.php
Code to add to wp-config.php to enhance information available for debugging.
View wp-config-debug.php
<?php
/**
* == About this Gist ==
*
* Code to add to wp-config.php to enhance information available for debugging.
*
* You would typically add this code below the database, language and salt settings
*
* Oh.. and *do* make sure you change the path to the log file to a proper file path on your server (make sure it exists).
*
@jasperf
jasperf / role-based-min-quantity.php
Last active Feb 16, 2020
WooCommerce Filter on user role to display minimum quantity of products with https://wordpress.org/plugins/product-quantity-for-woocommerce/
View role-based-min-quantity.php
add_filter( 'alg_wc_pq_get_product_qty_min', 'my_product_qty_min_by_user_role', 10, 2 );
function my_product_qty_min_by_user_role( $qty, $product_id ) {
$current_user = wp_get_current_user();
return ( in_array( 'bedrijf', $current_user->roles ) ? 10 : $qty );
}
@jasperf
jasperf / gist-oembed.php
Created Feb 14, 2020 — forked from ninnypants/gist-oembed.php
Quick WordPress plugin to add gists to oEmbed
View gist-oembed.php
<?php
/*
Plugin Name: Gist oEmbed
Plugin URI: http://ninnypants.com
Description: Embed gists into posts
Version: 1.0
Author: ninnypants
Author URI: http://ninnypants.com
License: GPL2
@jasperf
jasperf / Add-Custom-Fields-to-WooCommerce-Registration.php
Created Feb 14, 2020
Add Custom Fields to WooCommerce Registration
View Add-Custom-Fields-to-WooCommerce-Registration.php
add_action( 'woocommerce_register_form', 'wc_extra_registation_fields' );
function wc_extra_registation_fields() {
?>
<p class="form-row form-row-first">
<label for="reg_role"><?php _e( 'Privat or commercial?', 'woocommerce' ); ?></label>
<select class="input-text" name="role" id="reg_role">
<option <?php if ( ! empty( $_POST['role'] ) && $_POST['role'] == 'customer') esc_attr_e( 'selected' ); ?> value="customer">private</option>
<option <?php if ( ! empty( $_POST['role'] ) && $_POST['role'] == 'reseller') esc_attr_e( 'selected' ); ?> value="reseller">commercial</option>
</select>
</p>
You can’t perform that action at this time.