Pre-Populate Vendor/Venue Edit Profile Forms with User’s Pending Post Data

// Pre-populate edit form with data from existing post, regardless of status, with error handling add_filter(‘gform_pre_render’, ‘populate_edit_form_with_pending_post_data’); function populate_edit_form_with_pending_post_data($form) { // Get the current user ID and validate it $user_id = get_current_user_id(); if (!$user_id) { error_log(“Error: Unable to retrieve user…Continue reading

Disable default WordPress image sizes

// Disable default WordPress image sizes add_filter(‘intermediate_image_sizes’, ‘__return_empty_array’); // Disable large scaled image size add_filter(‘big_image_size_threshold’, ‘__return_false’); // Disable WooCommerce image sizes and prevent WooCommerce from regenerating sizes add_action(‘after_setup_theme’, function () { // WooCommerce image sizes remove_image_size(‘woocommerce_thumbnail’); remove_image_size(‘woocommerce_single’); remove_image_size(‘woocommerce_gallery_thumbnail’); // Clear…Continue reading

Add Auto Sizes to Lazy Loaded images (copy)

add_filter( ‘wp_get_attachment_image_attributes’, function( $attr ) { if ( ! isset( $attr[‘loading’] ) || ‘lazy’ !== $attr[‘loading’] || ! isset( $attr[‘sizes’] ) ) { return $attr; } // Skip if attribute was already added. if ( false !== strpos( $attr[‘sizes’], ‘auto,’…Continue reading

MemberPress: Changes Product Image on the Checkout Page (copy)

function mepr_custom_checkout_image() { ?> (function($) { $(document).ready(function() { // Select the product image on the checkout page and change its source to a new image URL $(“.mp-table > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > img:nth-child(1)”).attr(“src”,”https://airfryerkogebogen.dk/wp-content/uploads/2024/11/airfryerkogebogen.png”); }); })(jQuery); <?php } add_action(…Continue reading

Donation Form Email Check

add_filter(‘charitable_validate_donation_form_submission_email_check’, ‘charitable_test_for_email’, 10, 2 ); function charitable_test_for_email( $valid, $submitted ) { $email = $submitted->get_submitted_value( ’email’ ); // Add your logic here to see if the email is valid or not. // Return false if not valid, otherwise let the validation…Continue reading

Boton OneSignal = ok

// Agregar un shortcode para el botón function onesignal_register_button() { if (is_user_logged_in()) { $current_user = wp_get_current_user(); $email = $current_user->user_email; // Botón que llama a la función de registro en OneSignal mediante AJAX return ‘ Recibir notificaciones ‘; } else {…Continue reading

Add the Buy on Kindle button near Add to Cart in WooCommerce PDP.

/** * Snippet Name: Add the Buy on Kindle button near Add to Cart in WooCommerce PDP. */ add_action(‘woocommerce_after_add_to_cart_button’,’add_kindle_button’); function add_kindle_button() { $kindle_button_url = get_post_meta( get_the_ID(),’kindle_button_url’,true); if ( isset($kindle_button_url) && filter_var($kindle_button_url, FILTER_VALIDATE_URL)) { $style = ‘style=”background-color: #ff9900; color: #fff;’; $button…Continue reading