obj.date = keys[i];
obj.event = events[keys[i]][j];
function custom_date_upload_folder(WP_REST_Request $request) {
$custom_date = sanitize_text_field($request['custom_date']);
add_filter('upload_dir', function ($uploads) use ($custom_date) {
$uploads['subdir'] = '/' . $custom_date;
$uploads['path'] = $uploads['basedir'] . $uploads['subdir'];
$uploads['url'] = $uploads['baseurl'] . $uploads['subdir'];
return $uploads;
});
return new WP_REST_Response('Custom date folder set: ' . $custom_date, 200);
}
add_action('rest_api_init', function () {
register_rest_route('custom/v1', '/upload-folder/', array(
'methods' => 'POST',
'callback' => 'custom_date_upload_folder',
'args' => array(
'custom_date' => array(
'required' => true,
'validate_callback' => function ($param, $request, $key) {
return is_string($param);
}
),
),
));
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
font-family: Ubuntu;
}
img {
display: block;
width: 100%;
max-width: 100%;
}
.header {
text-align: center;
}
.container {
display: flex;
gap: 24px;
width: 95%;
max-width: 1280px;
margin: 0 auto;
}
.left {
flex: 0 1 280px;
}
.right {
flex: 1 1 auto;
}
@media only screen and (max-width: 768px) {
.container {
flex-direction: column;
}
}
</style>
</head>
<body>
<header class="header">
<nav>
<a href="index.html">Главная</a> |
<a href="http://pw2.ru/">Главная сервера</a> |
<a href="communication.html">Связь в клане</a>
</nav>
<h1>Добро пожаловать на сайт PW-клана "Белый Лис"!</h1>
</header>
<main>
<div class="container">
<!-- BEGIN Sidebar -->
<div class="left">
<h2>sidebar</h2>
<img src="https://placehold.co/300x400" alt="my awesome image" />
</div>
<!-- END Sidebar -->
<!-- BEGIN Content -->
<div class="right">
<h2>main content</h2>
<img src="https://placehold.co/600x400" alt="my awesome image" />
</div>
<!-- END Content -->
</div>
</main>
</body>
</html>
const buildFolder = `./results`; //Также можно использовать rootFolder
//...
return app.gulp.src(`${app.path.srcFolder}/**/*.*`, {})
//..
import { deleteAsync } from "del"
import zipPlugin from "gulp-zip"
export const zip = () => {
deleteAsync(`./${app.path.rootFolder}.zip`);
// return app.gulp.src(`${app.path.buildFolder}/.**/*.*`, {})
return app.gulp.src(`${app.path.buildFolder}/**/*.*`, {})
.pipe(app.plugins.plumber(
app.plugins.notify.onError({
title: "ZIP",
message: "Error:<%= error.message %>"
})
)
)
.pipe(zipPlugin(`./${app.path.rootFolder}.zip`))
.pipe(app.gulp.dest('./'));
}
export const zip = () => {
console.log(app.path) // <-- here
deleteAsync(`./${app.path.buildFolder}/.**/*.*`, {})
// ...
}