Skip to content

Instantly share code, notes, and snippets.

View PluginRepublicSupport's full-sized avatar

PluginRepublicSupport

View GitHub Profile
@PluginRepublicSupport
PluginRepublicSupport / wcdpp_tutorlms.php
Last active September 4, 2023 08:56
Some compatibility functions between Deposits and Part Payments and Tutor LMS
<?php
/**
* This function updates a 'tutor_enrolled' post type after it is created by a scheduled order. Changing the status prevents them from being counted towards totals.
*/
function wcdpp_tutor_after_enrolled( $course_id, $user_id, $enrolled_id ) {
// get the order_id attached to this tutor_enrolled record
$order_id = get_post_meta( $enrolled_id, '_tutor_enrolled_by_order_id', true );
if ( $order_id ) {
// check if order is a scheduled order
@PluginRepublicSupport
PluginRepublicSupport / pewc_polylang.php
Created March 8, 2023 06:48
For compatibility between Product Add-Ons Ultimate and Polylang
<?php
/**
* Duplicates groups and fields for translated products. Original product should have duplicated groups and fields by this time.
*/
function pewc_product_duplicate_polylang( $duplicate, $product ) {
// check that this function exists
if ( function_exists( 'pll_get_post_translations' ) ) {
$new_id = $duplicate->get_id();
$old_id = $product->get_id();
$new_trs = pll_get_post_translations( $new_id );
@PluginRepublicSupport
PluginRepublicSupport / open_all_accordions.php
Created February 13, 2023 13:12
Set accordion layout to Open
<?php
/**
* Set all groups to open (or closed ) in an accordion
*/
function prefix_filter_initial_accordion_states( $state, $post_id ) {
// return 'closed'; // Uncomment this out and comment the line below to set all groups to closed
return 'open';
}
add_filter( 'pewc_filter_initial_accordion_states', 'prefix_filter_initial_accordion_states', 10, 2 );
@PluginRepublicSupport
PluginRepublicSupport / image_preview_mobile.css
Created February 13, 2023 12:26
Image Preview Mobile View
@media (max-width: 600px) {
.wcpauau-modal-footer {
display: flex;
width: 100%;
justify-content: space-between;
}
.wcpauau-modal-footer .button {
font-size: 14px !important;
}
ul.pewc-product-extra-groups{
@PluginRepublicSupport
PluginRepublicSupport / custom_order_email_wc.php
Last active February 14, 2023 12:20
Custom WooCommerce Order Email
<?php
/**
* Quote request email
*/
defined( 'ABSPATH' ) || exit;
/*
* @hooked WC_Emails::email_header() Output the email header
*/
@PluginRepublicSupport
PluginRepublicSupport / pending_user_notice.php
Created February 10, 2023 12:48
Pending User Notice Members Only
<?php
/**
* Translate Pending User Notice
*/
function pending_user_notice( $notice ) {
$notice= "Käyttäjätilin tyyppi"; /** Translation here **/
return $notice;
}
@PluginRepublicSupport
PluginRepublicSupport / fee_discount_label.php
Last active February 9, 2023 14:51
Fee Discount Label Cart Page
<?php
function fee_discount_label( $fields ) {
$fields = 'Bulk order discount'; /** Change label test **/
return $fields;
}
add_filter( 'wcfad_cart_discount_label' , 'fee_discount_label' );
@PluginRepublicSupport
PluginRepublicSupport / remove_fields_rq_form.php
Created February 7, 2023 14:06
Remove fields in Request A Quote Form
<?php
function remove_quote_fields( $fields ) {
/** Remove company & message field **/
unset($fields['company']);
unset($fields['message']);
/** Make phone field required **/
$fields['phone']['required'] = true;
@PluginRepublicSupport
PluginRepublicSupport / disabled_dates_style.css
Created February 3, 2023 15:07
Booking Plugin Disabled Dates
/** Disabled dates color **/
.bfwc-optimise-colours .ui-datepicker td.ui-state-disabled {
background: #FF0000 !important;
opacity: 1 !important;
}
/** Fix calendar next/previous icons **/
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span{
display: none !important;
@PluginRepublicSupport
PluginRepublicSupport / role_label_translate.php
Created February 3, 2023 13:08
Translate Member Only Form Label
<?php
/**
* Translate Role label
*/
function example_callback( $role ) {
$role= "Käyttäjätilin tyyppi";
return $role;
}