diff --git a/.gitignore b/.gitignore index fe97113..8b47034 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /node_modules /.idea /.vscode +/hot diff --git a/css/app.css b/css/app.css index 2ecfbd5..e39224b 100644 --- a/css/app.css +++ b/css/app.css @@ -604,9 +604,6 @@ video { .h-1{ height: 0.25rem } -.h-12{ - height: 3rem -} .h-6{ height: 1.5rem } @@ -989,7 +986,6 @@ article > *:not(.entry-content), #loginform-custom input[type="text"], #loginform-custom input[type="password"]{ margin-bottom: 1rem; - height: 3rem; width: 100%; border-radius: 0.375rem; padding-left: 1rem; @@ -997,7 +993,6 @@ article > *:not(.entry-content), } #loginform-custom input[type="submit"]{ margin-bottom: 1rem; - height: 3rem; width: 100%; border-radius: 0.375rem; --tw-bg-opacity: 1; @@ -1006,6 +1001,10 @@ article > *:not(.entry-content), --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)) } +#loginform-custom input[type="checkbox"]{ + min-height: -moz-fit-content; + min-height: fit-content +} .form-add-event input, .form-add-event .acf-field input[type=text], .form-add-event .acf-field input[type=number]{ min-height: 3rem; border-radius: 0.375rem; diff --git a/css/editor-style.css b/css/editor-style.css index 197fb06..dc3b99b 100644 --- a/css/editor-style.css +++ b/css/editor-style.css @@ -74,15 +74,15 @@ .mb-8 { margin-bottom: 2rem } +.mr-3 { + margin-right: 0.75rem +} .mt-4 { margin-top: 1rem } .mt-8 { margin-top: 2rem } -.mr-3 { - margin-right: 0.75rem -} .block { display: block } @@ -104,18 +104,12 @@ .h-1 { height: 0.25rem } -.h-12 { - height: 3rem -} .h-6 { height: 1.5rem } .h-full { height: 100% } -.h-5 { - height: 1.25rem -} .min-h-12 { min-height: 3rem } @@ -134,9 +128,6 @@ .w-full { width: 100% } -.w-5 { - width: 1.25rem -} .min-w-max { min-width: -moz-max-content; min-width: max-content @@ -355,26 +346,14 @@ --tw-text-opacity: 1; color: rgb(17 24 39 / var(--tw-text-opacity)) } -.text-white { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)) -} -.text-amber-500 { - --tw-text-opacity: 1; - color: rgb(245 158 11 / var(--tw-text-opacity)) -} -.text-gray-300 { - --tw-text-opacity: 1; - color: rgb(209 213 219 / var(--tw-text-opacity)) -} -.text-slate-200 { - --tw-text-opacity: 1; - color: rgb(226 232 240 / var(--tw-text-opacity)) -} .text-slate-400 { --tw-text-opacity: 1; color: rgb(148 163 184 / var(--tw-text-opacity)) } +.text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity)) +} .underline { text-decoration-line: underline } diff --git a/header.php b/header.php index e7787de..3a62d81 100644 --- a/header.php +++ b/header.php @@ -74,7 +74,7 @@ - Se connecter + Se connecter 'evenements', 'posts_per_page' => 6, 'paged' => $paged, - 'meta_key' => 'date_debut', // Nom du champ ACF - 'orderby' => 'meta_value', // Trier par la valeur du champ - 'order' => 'ASC', // Ordre croissant ('DESC' pour décroissant) - 'meta_type' => 'DATE' // Préciser que c'est une date (important) + //'meta_key' => 'date_debut', // Nom du champ ACF + 'meta_query' => array( + 'relation' => 'OR', // Inclure les événements avec ou sans date de fin + array( + 'key' => 'date_debut', // Champ pour la date de début + 'value' => $today, // Comparer avec aujourd'hui + 'compare' => '>=', // Date de début aujourd'hui ou plus tard + 'type' => 'DATE', + ), + // Événements en cours (basé sur la date de fin) + array( + 'key' => 'date_fin', // Champ pour la date de fin + 'value' => $today, // Comparer avec aujourd'hui + 'compare' => '>=', // Date de fin aujourd'hui ou plus tard + 'type' => 'DATE', + ), + ), + 'orderby' => array( + 'date_debut' => 'ASC', // Trier par date de début + 'date_fin' => 'ASC', // Puis par date de fin + ), ); // The Query @@ -22,6 +39,7 @@ $query = new WP_Query( $args ); $date_debut = get_field('date_debut'); $date_fin = get_field('date_fin'); $code_postal = get_field('code_postal'); + $code_postal = empty($code_postal) ? '4800' : $code_postal; $organisme = get_field('organisme'); $lien_de_levenement = get_field('lien_de_levenement'); ?> diff --git a/htmx/past-events.php b/htmx/past-events.php new file mode 100644 index 0000000..7260945 --- /dev/null +++ b/htmx/past-events.php @@ -0,0 +1,81 @@ + 'evenements', + 'posts_per_page' => 6, + 'paged' => $paged, + //'meta_key' => 'date_debut', // Nom du champ ACF + 'meta_query' => array( + 'relation' => 'OR', // Inclure les événements avec ou sans date de fin + array( + 'key' => 'date_debut', // Champ pour la date de début + 'value' => $today, // Comparer avec aujourd'hui + 'compare' => '<', // Date de début aujourd'hui ou plus tard + 'type' => 'DATE', + ), + // Événements en cours (basé sur la date de fin) + array( + 'key' => 'date_fin', // Champ pour la date de fin + 'value' => $today, // Comparer avec aujourd'hui + 'compare' => '<', // Date de fin aujourd'hui ou plus tard + 'type' => 'DATE', + ), + ), + 'orderby' => array( + 'date_debut' => 'DESC', // Trier par date de début + 'date_fin' => 'DESC', // Puis par date de fin + ), +); + +// The Query +$query = new WP_Query( $args ); +?> + +have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?> + + + + + + + + + +

+ + + +have_posts() ) : +?> + + \ No newline at end of file diff --git a/includes/api.php b/includes/api.php index 6997941..57a447e 100644 --- a/includes/api.php +++ b/includes/api.php @@ -6,6 +6,11 @@ add_action('rest_api_init', function () { 'callback' => 'load_custom_template', 'permission_callback' => '__return_true', // Autorise l'accès à tous les utilisateurs ]); + register_rest_route('htmx/v1', '/past-events', [ + 'methods' => 'GET', + 'callback' => 'load_custom_template_past_events', + 'permission_callback' => '__return_true', // Autorise l'accès à tous les utilisateurs + ]); }); function load_custom_template($request) { @@ -29,12 +34,33 @@ function load_custom_template($request) { exit; } +function load_custom_template_past_events($request) { + // Nom du fichier de template à inclure (ex. : 'custom-template.php' dans votre thème) + $template = locate_template('htmx/past-events.php'); + + if ($template) { + // Capture la sortie du template pour l'inclure dans la réponse + ob_start(); + include $template; + $content = ob_get_clean(); + + header('Content-Type: text/html; charset=UTF-8'); + echo $content; + exit; // Important pour éviter que WordPress ajoute des données JSON supplémentaires + } + + // Retourne une erreur si le fichier template est introuvable + header('Content-Type: text/html; charset=UTF-8', true, 404); + echo 'Template introuvable.'; + exit; +} + // ENQUEUE HTMX add_action('wp_enqueue_scripts', 'add_scripts'); function add_scripts(){ wp_register_script( 'htmx', 'https://unpkg.com/htmx.org@2.0.3', false, null, true); - if(is_front_page()): + if(is_front_page() || is_page_template('template-passes.php')): wp_enqueue_script( 'htmx' ); endif; } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index e99e9df..359e49b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@jeffreyvr/tailwindcss-tailpress": "^2.0.0", "autoprefixer": "^10.4.0", "browser-sync": "^2.26.14", + "browser-sync-webpack-plugin": "^2.3.0", "cross-env": "^6.0.3", "laravel-mix": "^6.0.29", "postcss": "^8.2.10", @@ -3405,6 +3406,19 @@ "stream-throttle": "^0.1.3" } }, + "node_modules/browser-sync-webpack-plugin": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/browser-sync-webpack-plugin/-/browser-sync-webpack-plugin-2.3.0.tgz", + "integrity": "sha512-MDvuRrTCtoL11dTdwMymo9CNJvYxJoW67gOO61cThfzHNX40S5WcBU+0bVQ86ll7r7aNpNgyzxF7RtnXMTDbyA==", + "dev": true, + "dependencies": { + "lodash": "^4" + }, + "peerDependencies": { + "browser-sync": "^2", + "webpack": "^1 || ^2 || ^3 || ^4 || ^5" + } + }, "node_modules/browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -11817,8 +11831,7 @@ "version": "7.21.0-placeholder-for-preset-env.2", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", - "dev": true, - "requires": {} + "dev": true }, "@babel/plugin-syntax-async-generators": { "version": "7.8.4", @@ -13342,8 +13355,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", - "dev": true, - "requires": {} + "dev": true }, "@webpack-cli/info": { "version": "1.5.0", @@ -13358,8 +13370,7 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", - "dev": true, - "requires": {} + "dev": true }, "@xtuc/ieee754": { "version": "1.2.0", @@ -13393,8 +13404,7 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", - "dev": true, - "requires": {} + "dev": true }, "adjust-sourcemap-loader": { "version": "3.0.0", @@ -13451,8 +13461,7 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, - "requires": {} + "dev": true }, "ansi-html-community": { "version": "0.0.8", @@ -13862,6 +13871,15 @@ "stream-throttle": "^0.1.3" } }, + "browser-sync-webpack-plugin": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/browser-sync-webpack-plugin/-/browser-sync-webpack-plugin-2.3.0.tgz", + "integrity": "sha512-MDvuRrTCtoL11dTdwMymo9CNJvYxJoW67gOO61cThfzHNX40S5WcBU+0bVQ86ll7r7aNpNgyzxF7RtnXMTDbyA==", + "dev": true, + "requires": { + "lodash": "^4" + } + }, "browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -14475,8 +14493,7 @@ "version": "6.4.1", "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz", "integrity": "sha512-rtdthzxKuyq6IzqX6jEcIzQF/YqccluefyCYheovBOLhFT/drQA9zj/UbRAa9J7C0o6EG6u3E6g+vKkay7/k3g==", - "dev": true, - "requires": {} + "dev": true }, "css-loader": { "version": "5.2.7", @@ -14607,8 +14624,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-3.1.0.tgz", "integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==", - "dev": true, - "requires": {} + "dev": true }, "csso": { "version": "4.2.0", @@ -15932,8 +15948,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", - "dev": true, - "requires": {} + "dev": true }, "ieee754": { "version": "1.2.1", @@ -17263,29 +17278,25 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz", "integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==", - "dev": true, - "requires": {} + "dev": true }, "postcss-discard-duplicates": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz", "integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==", - "dev": true, - "requires": {} + "dev": true }, "postcss-discard-empty": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz", "integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==", - "dev": true, - "requires": {} + "dev": true }, "postcss-discard-overridden": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz", "integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==", - "dev": true, - "requires": {} + "dev": true }, "postcss-import": { "version": "14.1.0", @@ -17394,8 +17405,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz", "integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==", - "dev": true, - "requires": {} + "dev": true }, "postcss-modules-local-by-default": { "version": "4.0.3", @@ -17513,8 +17523,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz", "integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==", - "dev": true, - "requires": {} + "dev": true }, "postcss-normalize-display-values": { "version": "5.1.0", @@ -19576,8 +19585,7 @@ "version": "8.15.1", "resolved": "https://registry.npmjs.org/ws/-/ws-8.15.1.tgz", "integrity": "sha512-W5OZiCjXEmk0yZ66ZN82beM5Sz7l7coYxpRkzS+p9PP+ToQry8szKh+61eNktr7EA9DOwvFGhfC605jDHbP6QQ==", - "dev": true, - "requires": {} + "dev": true } } }, @@ -19688,8 +19696,7 @@ "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "dev": true, - "requires": {} + "dev": true }, "xmlhttprequest-ssl": { "version": "2.0.0", diff --git a/package.json b/package.json index 9964a1f..9e9a334 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@jeffreyvr/tailwindcss-tailpress": "^2.0.0", "autoprefixer": "^10.4.0", "browser-sync": "^2.26.14", + "browser-sync-webpack-plugin": "^2.3.0", "cross-env": "^6.0.3", "laravel-mix": "^6.0.29", "postcss": "^8.2.10", diff --git a/resources/css/form.css b/resources/css/form.css index 9c28ab1..ed44f3f 100644 --- a/resources/css/form.css +++ b/resources/css/form.css @@ -6,11 +6,15 @@ input[type="text"], input[type="password"]{ - @apply mb-4 h-12 w-full rounded-md px-4; + @apply mb-4 w-full rounded-md px-4; } input[type="submit"]{ - @apply mb-4 h-12 w-full rounded-md bg-primary text-center text-white; + @apply mb-4 w-full rounded-md bg-primary text-center text-white; + } + + input[type="checkbox"]{ + @apply min-h-fit; } } \ No newline at end of file diff --git a/template-parts/content.php b/template-parts/content.php index 25f97d7..d267348 100644 --- a/template-parts/content.php +++ b/template-parts/content.php @@ -14,7 +14,7 @@ if (is_front_page() && is_user_logged_in()): else: ?> -
+