Allow SVG/JPEG/WEBP/ICO/AVIF Files Upload

function allow_additional_mime_types($mime_types) { $mime_types[‘jpeg’] = ‘image/jpeg’; $mime_types[‘svg’] = ‘image/svg+xml’; $mime_types[‘webp’] = ‘image/webp’; $mime_types[‘avif’] = ‘image/avif’; $mime_types[‘ico’] = ‘image/vnd.microsoft.icon’; return $mime_types; } add_filter(‘upload_mimes’, ‘allow_additional_mime_types’);Continue reading

Allow ICO Files Upload

function custom_allow_ico_upload($mimes) { $allowed_mime_types = array( ‘ico’ => ‘image/x-icon’ ); // Merge the allowed MIME types with the existing list $mimes = array_merge($mimes, $allowed_mime_types); return $mimes; } add_filter(‘upload_mimes’, ‘custom_allow_ico_upload’); function custom_handle_ico_upload_errors($file, $uploaded_file) { if (!empty($file[‘type’]) && $file[‘type’] === ‘image/x-icon’ &&…Continue reading

Allow WebP Files Upload

// Add WebP MIME type support function add_webp_mime_type($mime_types) { $mime_types[‘webp’] = ‘image/webp’; return $mime_types; } add_filter(‘upload_mimes’, ‘add_webp_mime_type’); // Enable WebP in the Media Library function enable_webp_upload($data, $file) { $file[‘ext’] = ‘webp’; return $data; } add_filter(‘wp_handle_upload_prefilter’, ‘enable_webp_upload’, 10, 2); // Enable…Continue reading

Calculadora 2.5

Licencia 499€/Mes Licencia 6.000€ Licencia 9.500€ Licencia 49.000€ Ganancia NETA: Duración de la inversión:  El “Interés Compuesto” representa una de las estrategias financieras más potentes disponibles. Se trata de un sistema en el cual las ganancias derivadas de una inversión…Continue reading

Kupon kódok megjelenítése az értesítő email-ekben

add_action( ‘woocommerce_email_order_meta’, function( $order, $sent_to_admin, $plain_text, $email ) { // Check if coupon is used in order if ( $order->get_used_coupons() ) { // Get the coupon codes used in the order $coupon_codes = implode( ‘, ‘, $order->get_used_coupons() ); // Set…Continue reading

Explicit Fixed Width and Height

add_filter( ‘the_content’, ‘add_image_dimensions’ ); function add_image_dimensions( $content ) { preg_match_all( ‘/]+>/i’, $content, $images); if (count($images) < 1) return $content; foreach ($images[0] as $image) { preg_match_all( '/(alt|title|src|width|class|id|height)=("[^"]*")/i', $image, $img ); if ( !in_array( 'src', $img[1] ) ) continue; if ( !in_array(…Continue reading

Get YouTube ID

function theme_get_video_id($url=”){ $url_parts = array(); $video_id = ”; if(!empty($url) && is_string($url)){ if(strpos($url,’youtube.be’) !== false){ $url_parts = explode(‘be/’,$url); }elseif(strpos($url,’?v=’) !== false){ $url_parts = explode(‘?v=’,$url); }elseif(strpos($url,’/v/’) !== false){ $url_parts = explode(‘/v/’,$url); }elseif(strpos($url,’/shorts/’) !== false){ $url_parts = explode(‘/shorts/’,$url); } if(isset($url_parts[0]) && isset($url_parts[1])){ if(strpos($url_parts[1],’?’)…Continue reading