add_action( 'wp_head' , 'width768' );
function width768(){
?>
<script type='text/javascript'>
// Create a media condition that targets viewports at least 768px wide
const mediaQuery = window.matchMedia('(min-width: 768px)')
// Check if the media query is true
if (mediaQuery.matches) {
alert('Media Query Matched!')
add_action( 'after_setup_theme', 'remove_woo_three_support', 11 );
function remove_woo_three_support() {
remove_theme_support( 'wc-product-gallery-zoom' );
remove_theme_support( 'wc-product-gallery-slider' );
};
}
</script>
<?php
}
function sendEmail($input, $leadId, $errorFiles, $goodFiles)
{
$ok = true;
$siteName = getSiteName();
$subject = $input["text"]["leadId"]
? "Заявка {$input["text"]["leadId"]} с сайта $siteName"
: "Заявка с сайта $siteName";
$uid = md5(uniqid(time()));
$body = "--$uid\r\n";
$body .= "Content-type:text/html; charset=utf-8\r\n";
$body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$body .= "<html><body>";
$body .= $input["text"]["leadId"]
? "<p>Апселл к заказу {$input["text"]["leadId"]}:</p>"
: "<p>Новый заказ:</p>";
$body .= "<ul>";
foreach ($input["text"] as $name => $value) {
$value = is_array($value) ? join(", ", $value) : $value;
$name != "redirect" && $name != "leadId" && $name != "MAX_FILE_SIZE" && $body .= "<li>$name: $value</li>";
}
$body .= "
<li>IP: {$_SERVER["REMOTE_ADDR"]}</li>
<li>URL: {$_SERVER["HTTP_REFERER"]}</li>
<li>User Agent: {$_SERVER["HTTP_USER_AGENT"]}</li>
</ul>
";
if (count($errorFiles) != 0) {
$body .= "<p>Ошибки загрузки файлов:</p><ul>";
foreach ($errorFiles as $file) {
$body .= "<li>{$file["name"]}: " . translateUploadError($file["error"]) . "</li>";
}
$body .= "</ul>";
}
$body .= "</body></html>\r\n\r\n";
foreach ($goodFiles as $file) {
$body .= "--$uid\r\n";
$body .= "Content-Type: application/octet-stream; name=\"{$file["name"]}\"\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n";
$body .= "Content-Disposition: attachment; filename=\"{$file["name"]}\"\r\n\r\n";
$content = chunk_split(base64_encode(file_get_contents($file["tmp_name"])));
$body .= "$content\r\n\r\n";
}
$body .= "--$uid--";
try {
$sent = mail(NOTIFICATIONS_EMAIL, $subject, $body, implode("\r\n", [
"MIME-Version: 1.0",
"Content-type: multipart/mixed; boundary=\"$uid\""
]));
if (!$sent) {
throw new Exception("Email not accepted by MTA");
}
} catch (Exception $e) {
error_log("Fail to send notification email: $e", 0);
$ok = false;
}
return $ok;
}
$info = "
<html lang='ru'>
<head>
<title>бла бла</title>
<style>
div {
}
</style>
</head>
<body>
<div>
<div>
<p>бла бла ба</p>
</div>
</body>
</html>
";
const NOTIFICATIONS_EMAIL = "admin@gmail.com";
$touser = $_POST['Email'];
if (defined("NOTIFICATIONS_EMAIL") && NOTIFICATIONS_EMAIL != "") {
$emailSent = sendEmail($input, $leadId, $errorFiles, $goodFiles);
$touser = sendEmail($input, $leadId, $errorFiles, $goodFiles);
}
const USER_EMAIL = $_POST['Email'];
if (defined("USER_EMAIL") && USER_EMAIL != "") {
$emailSent = sendEmail($input, $leadId, $errorFiles, $goodFiles);
}
но
в хтмл видим в футере jquery который не работает))
или это какой то не тот jquery ща в футере (по коду вроде полностью он и версия 3.6.0)
проблему решил обернув скрипт в my.js полностью в jQuery(function($) { код }
но логику не понял
пробывал так
таже фигня