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

Detail 1682

$indextls = htmlspecialchars($_REQUEST[‘indextls’]); //echo ‘indextls = ‘.$indextls; $Host = “localhost”; $User = “i9065950_wp2”; $Password = “E.SaEj4ol3IAOnlC0ur27”; $DBName = “i9065950_wp2”; $Table = “cemdata”; //error_reporting(0); //echo ‘Add additional information for this person‘; $query = “SELECT * from cemdata where indextls = ‘$indextls’”;…Continue reading

CSS – listes

@property –nat-li-icon { syntax: ““; inherits: false; initial-value: disc; } @property –nat-bgcolor { syntax: ““; inherits: false; initial-value: white; } @property –nat-color { syntax: ““; inherits: false; initial-value: black; } /* Pour les listes */ .nat-li-tkome {–nat-li-icon:”※ “;} .nat-li-tnote {–nat-li-icon:”Note…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

Add Select Field To Donation Form (copy)

/** * Add a select field to the donation form. * * Fields are added as a PHP array that define the field. * * This snippet only works in Charitable 1.5 or above. * */ function ed_charitable_register_new_select_field() { if…Continue reading