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
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
// Define the API URL const apiUrl = ‘https://api.example.com/data’; // Make a GET request fetch(apiUrl) .then(response => { if (!response.ok) { throw new Error(‘Network response was not ok’); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => {…Continue reading
function deleteOmCookie() { document.cookie = “omGlobalInteractionCookie=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;”; } deleteOmCookie();Continue reading
add_action( ‘jet-form-builder/media-field/before-upload’, /** * @var Jet_Form_BuilderRequestFieldsMedia_Field_Parser $parser */ function ( $parser ) { $class_name = $parser->get_context()->get_class_name(); // We need to add ‘allow-insert-attachments’ to the Advanced -> CSS Class Name option if ( ! $class_name || false === strpos( $class_name, ‘allow-insert-attachments’…Continue reading