Coming Soon Products

add_filter( ‘woocommerce_get_availability_text’, ‘wsp_custom_coming_soon_text’, 10, 2 ); function wsp_custom_coming_soon_text( $text, $product ) { if ( ! $product ) { return $text; } // Get the correct product ID (parent for variations) $product_id = $product->get_id(); if ( $product->is_type( ‘variation’ ) ) {…Continue reading

Age Gate Attestation

add_action(‘age_gate/custom/after’, ‘my_custom_fields’); function my_custom_fields() { echo ‘ I agree and understand that certain products on this site are intended for research use only, as defined by the FDA. I also agree to the Research Use Only Policy of this site.‘;…Continue reading

Variable Pricing Dropdown (copy)

function edd_library_variable_price_dropdown() { function shoestrap_edd_purchase_variable_pricing( $download_id ) { $variable_pricing = edd_has_variable_prices( $download_id ); if ( ! $variable_pricing ) return; $prices = apply_filters( ‘edd_purchase_variable_prices’, edd_get_variable_prices( $download_id ), $download_id ); $type = edd_single_price_option_mode( $download_id ) ? ‘checkbox’ : ‘radio’; do_action( ‘edd_before_price_options’, $download_id…Continue reading

Add data-attr to links

function add_data_attributes_to_content_links( $content ) { if ( class_exists( ‘DOMDocument’ ) ) { // Use the mb_convert_encoding to handle different character sets correctly // and suppress HTML errors with the @ operator and LIBXML options. $dom = new DOMDocument(); @$dom->loadHTML( mb_convert_encoding(…Continue reading

Redirect user to 3blmedia.com

add_action( ‘template_redirect’, function() { // Define the external website URL $external_url = ‘https://www.3blmedia.com/?ref=https://3blmedia.net’; // Check if we are NOT in the admin panel and NOT on the login page if ( ! is_admin() && strpos($_SERVER[‘PHP_SELF’], ‘wp-login.php’) === false ) {…Continue reading

mobile redirect (chatgpt)

// Mobile redirect (admin INCLUDED, cache-friendly) add_action(‘template_redirect’, ‘rd_mobile_redirect’, 10); function rd_mobile_redirect() { // Skip only AJAX/cron/preview/REST to avoid breaking editors & API if (wp_doing_ajax() || wp_doing_cron() || is_preview() || defined(‘REST_REQUEST’)) return; $req_uri = $_SERVER[‘REQUEST_URI’] ?? ‘/’; $path = strtok($req_uri, ‘?’);…Continue reading

Homepage/PGs of the world – ArcGIS API / MySQL fallback PG stats – create shortcodes – PROD LIBRARY

/** * ArcGIS People Groups Statistics * Queries the pIMBpeoplePublic FeatureServer and displays statistics * */ // Define the ArcGIS service URL if (!defined(‘ARCGIS_SERVICE_URL’)) { define(‘ARCGIS_SERVICE_URL’, ‘https://services2.arcgis.com/S4ydGgujXcif36k3/ArcGIS/rest/services/pgOrgPointsStaging/FeatureServer/0/query’); } /** * Query ArcGIS service for statistics * * @param string $where_clause…Continue reading

Set Stripe as default gateway in checkout

add_action(‘template_redirect’, ‘define_default_payment_gateway’); function define_default_payment_gateway() { // Prevent execution during admin, AJAX, or scheduled tasks if (is_admin() || wp_doing_ajax() || wp_doing_cron()) { return; } if (is_checkout() && !is_wc_endpoint_url()) { WC()->session->set(‘chosen_payment_method’, ‘stripe’); } }Continue reading