Skip to content

Instantly share code, notes, and snippets.

Avatar

PluginRepublicSupport

View GitHub Profile
@PluginRepublicSupport
PluginRepublicSupport / text_custom_fonts.php
Created March 20, 2023 15:15
Text Preview Custom Fonts
View text_custom_fonts.php
<?php
/**
* Register a custom font with Text Preview
*/
function prefix_register_custom_font( $fonts ) {
$fonts['font-1'] = 'Brush Script';
$fonts['font-2'] = 'Arial';
$fonts['font-3'] = 'Mermaid';
$fonts['font-4'] = 'Angelina';
@PluginRepublicSupport
PluginRepublicSupport / group_title_html.php
Created March 15, 2023 15:33
Change Group Title HTML Element
View group_title_html.php
<?php
function my_group_filter_title( $group_title, $group, $group_id ) {
$group_title = pewc_get_group_title( $group_id, $group, true );
return '<h2>' . $group_title . '</h2>';
}
add_filter( 'pewc_filter_group_title', 'my_group_filter_title', 10, 3 );
@PluginRepublicSupport
PluginRepublicSupport / wcrp_rental_products.php
Last active March 13, 2023 12:13
Add-ons on Rental Product Type
View wcrp_rental_products.php
<?php
add_filter( 'pewc_filter_product_extra_groups', function( $product_extra_groups, $post_id) {
if ( is_cart() || is_checkout() ) {
return $product_extra_groups;
}
if( ! is_object( wc_get_product( $post_id ) ) ) {
return $product_extra_groups;
}
@PluginRepublicSupport
PluginRepublicSupport / wcdpp_tutorlms.php
Last active March 8, 2023 09:43
Some compatibility functions between Deposits and Part Payments and Tutor LMS
View wcdpp_tutorlms.php
<?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
View pewc_polylang.php
<?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
View open_all_accordions.php
<?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
View image_preview_mobile.css
@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
View custom_order_email_wc.php
<?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
View pending_user_notice.php
<?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
View fee_discount_label.php
<?php
function fee_discount_label( $fields ) {
$fields = 'Bulk order discount'; /** Change label test **/
return $fields;
}
add_filter( 'wcfad_cart_discount_label' , 'fee_discount_label' );