Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Filter the list of active plugins for custom endpoint requests.
*
* @param array $active_plugins The list of active plugins.
*
* @return array The filtered list of active plugins.
*/
function filter_active_plugins( $active_plugins ) {
<?php
/**
* Modify max length of first name field in WooCommerce.
*
* @param array $fields
*
* @return array
*/
function flux_modify_fname_field_length( $fields ) {
(function( $, document ) {
var orderable_switch_pricing = {
vars: {
'cycle_buttons': '.orderable-switch .kt-button',
'qty_buttons': '.orderable-qty .kt-button',
'active_toggle': 'kt-button--active',
'checkout_url': 'https://my.orderable.com/checkout/?wcf-default=',
'pricing': {
'annual': {
'1': {
@jamesckemp
jamesckemp / changelog.yml
Created June 16, 2021 16:57
Add pull request title to end of changelog file on PR merge
on:
pull_request:
branches:
- dev
types: [closed]
jobs:
update_changelog:
name: Update and Commit Changelog
runs-on: ubuntu-latest
@jamesckemp
jamesckemp / functions.php
Created May 6, 2021 13:37
Change the variable product button text in WooCommerce
<?php
/**
* Change variable product text.
*
* [link to article]
*
* @param string $button_text
* @param WC_Product $product
*
@jamesckemp
jamesckemp / snippet.php
Last active January 4, 2021 14:07
Change the WooCommerce Delivery Slots by Iconic maximum selectable date dynamically based on time
<?php
/**
* Change maximum delivery date.
* https://iconicwp.com/products/woocommerce-delivery-slots/?utm_source=Iconic&utm_medium=Gist&utm_campaign=max-selectable-date
*
* @param array $max
*
* @return array
*/
@jamesckemp
jamesckemp / description.php
Created August 12, 2020 09:49
Use parent description for variation.
<?php
/**
* Use parent's description.
*/
function iconic_woocommerce_short_description( $description ) {
if ( ! is_archive() ) {
return $description;
}
function iconic_disable_qv_images() {
global $jckqv;
if ( empty( $jckqv ) ) {
return;
}
add_action( 'jck_qv_images', array( $jckqv, 'modal_part_images' ), 10, 3 );
}
function iconic_remove_admin_redirect() {
remove_action( 'admin_init', array( 'JCK_SFR_User', 'redirect_voters' ), 10 );
}
add_action( 'init', 'iconic_remove_admin_redirect' );
/**
* Modify delivery slots labels.
*
* @param array $labels
* @param null|WC_Order $order
*
* @return array
*/
function iconic_modify_delivery_slots_labels( $labels, $order ) {
$chosen_shipping = $order ? iconic_get_order_shipping_method( $order ) : iconic_get_selected_shipping_method();