Show more Landings

document.addEventListener(“DOMContentLoaded”, function () { // Get all Read More buttons const readMoreButtons = document.querySelectorAll(‘.read-more’); readMoreButtons.forEach(button => { button.addEventListener(‘click’, function (event) { event.preventDefault(); const feature = this.closest(‘.feature’); const longDesc = feature.querySelector(‘.long-desc’); const shortDesc = feature.querySelector(‘.short-desc’); if (longDesc.style.display === “none”) { longDesc.style.display…Continue reading

Copyright & Current Year Shortcodes

/** * Returns the current year. * * @return string Current year in YYYY format. */ function get_current_year() { return date(‘Y’); } /** * Shortcode to display the current year. * * @return string HTML span with current year. */…Continue reading

Smart convert images to webp

function convert_to_webp($file) { $file_path = $file[‘file’]; $file_type = $file[‘type’]; // Only for JPEG, PNG, and GIF images if (in_array($file_type, [‘image/jpeg’, ‘image/png’, ‘image/gif’, ‘image/jpg’])) { $webp_path = preg_replace(‘/\.(jpe?g|png|gif)$/i’, ‘.webp’, $file_path); // Check if the GD library is available if (!function_exists(‘gd_info’)) {…Continue reading

MemberPress: Whitelist Domains

function mepr_custom_is_domain_whitelisted() { $whitelist = array( “domain.com, domain1.com” ); //comma-separated list of domains $domain = parse_url( $_SERVER[ ‘HTTP_REFERER’ ], PHP_URL_HOST ); if ( !empty($domain ) && in_array( $domain, $whitelist ) ) { return true; //Exclude from paywall } return false;…Continue reading

MemberPress: Turn Off Auto-Rebill for Offline Gateway

//Turn off Auto rebill for offline gateway if a transactions expires function turn_off_auto_rebill_offline_gateway( $txn, $sub_status ) { if ( $txn->payment_method() instanceof MeprArtificialGateway && $sub = $txn->subscription() ) { $sub->status = MeprSubscription::$cancelled_str; $sub->store(); } } add_action( ‘mepr-transaction-expired’, ‘turn_off_auto_rebill_offline_gateway’, 9, 2 );…Continue reading

MemberPress: Change Non-Recurring Renewal Price

function mepr_change_product_renewal_price( $product_price, $coupon_code, $product ) { $user = new MeprUser( get_current_user_id() ); $subscriptions = $user->active_product_subscriptions( ‘ids’, true, true ); // change the 123 ID to the required one-time membership ID if ( $product->ID === 123 && in_array( $product->ID, $subscriptions…Continue reading

Customize Gift Card Code

/* Customize the generated Gift Card Code */ function agcfw_change_prefix() { return array( ‘characters’ => ‘ABCDEFGHJKMNPQRSTUVWXYZ23456789’, // Defines the characters used in the coupon code ‘length’ => 10, // Sets the length of the generated code to 10 characters ‘prefix’…Continue reading

The draft of receipt

from reportlab.lib.pagesizes import A4 from datetime import datetime from reportlab.platypus import Table, TableStyle, Paragraph, SimpleDocTemplate, Image, Frame, PageTemplate from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet current_time = datetime.now() curr_date = current_time.date() time = current_time.strftime(“%H:%M:%S”) receipt_no = current_time.strftime(“%y%m%d%H%M%S”) # Style…Continue reading