This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add a custom product data tab | |
| */ | |
| add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' ); | |
| function woo_new_product_tab( $tabs ) { | |
| // Adds the new tab | |
| $tabs['test_tab'] = array( | |
| 'title' => __( 'New Product Tab', 'woocommerce' ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Check if product has attributes, dimensions or weight to override the call_user_func() expects parameter 1 to be a valid callback error when changing the additional tab | |
| */ | |
| add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); | |
| function woo_rename_tabs( $tabs ) { | |
| global $product; | |
| if( $product->has_attributes() || $product->has_dimensions() || $product->has_weight() ) { // Check if product has attributes, dimensions or weight |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Remove product data tabs | |
| */ | |
| add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); | |
| function woo_remove_product_tabs( $tabs ) { | |
| unset( $tabs['description'] ); // Remove the description tab | |
| unset( $tabs['reviews'] ); // Remove the reviews tab | |
| unset( $tabs['additional_information'] ); // Remove the additional information tab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Auto Complete all WooCommerce orders. | |
| */ | |
| add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); | |
| function custom_woocommerce_auto_complete_order( $order_id ) { | |
| if ( ! $order_id ) { | |
| return; | |
| } | |
| $order = wc_get_order( $order_id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add custom tracking code to the thank-you page | |
| */ | |
| add_action( 'woocommerce_thankyou', 'my_custom_tracking' ); | |
| function my_custom_tracking( $order_id ) { | |
| // Lets grab the order | |
| $order = wc_get_order( $order_id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Woocommerce Styles */ | |
| /* | |
| A couple things to note... | |
| 1. This code was written very specifically for my base child theme so it might not work out of the box with every theme. | |
| I have it here mostly to share with anyone who might be looking to do the same thing I was. | |
| 2. I generally add my WooCommerce CSS overrides to a custom-woo.css file then use wp_enqueue_style() to call it | |
| so that it enqueues after the default WooCommerce Stylesheets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint-disable */ | |
| const fetch = require('node-fetch') | |
| const rechargeToken = process.env.RECHARGE_TOKEN | |
| const subscriptionIntervalFrequency = process.env.SUBSCRIPTION_INTERVAL_FREQUENCY || 30 | |
| const subscriptionIntervalUnit = process.env.SUBSCRIPTION_INTERVAL_UNIT || 'day' | |
| /** | |
| * Builds request headers | |
| * @return {Array} | |
| */ | |
| const buildHeaders = () => ({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: wordpress assist clean header | |
| Plugin URI: http://www.wordpressassist.nl/ | |
| Description: Remove shortlink hook | |
| Version: 1.0 | |
| Author: AukeJomm | |
| Author URI: http://www.aukejongbloed.nl | |
| */ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // inspired by: https://gist.github.com/rveitch/9018669face1686e74aaa68026856f36 | |
| // add title to CPTs which doesn't provide a title (useful for the relationship field (https://www.advancedcustomfields.com/resources/relationship/)) | |
| function sync_acf_post_title($post_id, $post, $update) { | |
| $post_type = get_post_type($post_id); | |
| // check for the current CPT | |
| if($post_type === "cpt_name_1") { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Changes Gravity Forms Ajax Spinner (next, back, submit) to a transparent image | |
| // this allows you to target the css and create a pure css spinner like the one used below in the style.css file of this gist. | |
| add_filter( 'gform_ajax_spinner_url', 'spinner_url', 10, 2 ); | |
| function spinner_url( $image_src, $form ) { | |
| return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; // relative to you theme images folder | |
| } |