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’, /** * Fired before JetFormBuilder uploads a file for a Media field. * * @param \Jet_Form_Builder\Request\Fields\Media_Field_Parser $parser */ function ( $parser ) { // Extra guard: bail out if the expected object is not passed. if ( !…Continue reading