updating code

This commit is contained in:
Antoine M 2023-10-17 17:36:31 +02:00
parent 4928521eff
commit 41d615f870
12 changed files with 450 additions and 72 deletions

View File

@ -13,5 +13,6 @@ require_once(__DIR__ . '/includes/utilities.php');
require_once(__DIR__ . '/includes/navwalker.php');
require_once(__DIR__ . '/includes/templates.php');
require_once(__DIR__ . '/includes/ajax.php');
require_once(__DIR__ . '/includes/api.php');
// require_once(__DIR__ . '/includes/widget.php');

23
includes/api.php Normal file
View File

@ -0,0 +1,23 @@
<?php
add_action('rest_api_init', function () {
register_rest_route('homegrade/v1', '/salut/(?P<id>\d+)', array(
'methods' => 'GET',
'callback' => 'my_awesome_func',
));
});
add_action('rest_api_init', function () {
register_rest_route('homegrade/v1', '/salut', array(
'methods' => 'GET',
'callback' => 'my_awesome_func',
));
});
function my_awesome_func($request)
{
$id = $request['id'];
$response = new WP_REST_Response("salut" . $id);
$response->set_status(200);
return $response;
}

View File

@ -68,6 +68,7 @@ function tailpress_enqueue_scripts()
'yes' => __('Oui', 'homegrade-theme__texte-fonctionnel'),
'no' => __('Non', 'homegrade-theme__texte-fonctionnel'),
'template_directory_uri' => get_template_directory_uri(),
'current_thematique' => get_the_terms(get_the_ID(), 'thematiques')[0],
);
wp_localize_script('main-app-js', 'mainAppJsDynamicDatas', $main_app_js_dynamic_datas);

294
package-lock.json generated
View File

@ -8,6 +8,9 @@
"name": "tailpress",
"version": "3.0.0",
"license": "MIT",
"dependencies": {
"@wordpress/api-fetch": "^6.40.0"
},
"devDependencies": {
"@jeffreyvr/tailwindcss-tailpress": "^2.0.0",
"autoprefixer": "^10.4.0",
@ -22,6 +25,17 @@
"tailwindcss": "^3.1.0"
}
},
"node_modules/@babel/runtime": {
"version": "7.23.2",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz",
"integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@jeffreyvr/tailwindcss-tailpress": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@jeffreyvr/tailwindcss-tailpress/-/tailwindcss-tailpress-2.0.0.tgz",
@ -69,6 +83,33 @@
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==",
"dev": true
},
"node_modules/@tannin/compile": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/compile/-/compile-1.1.0.tgz",
"integrity": "sha512-n8m9eNDfoNZoxdvWiTfW/hSPhehzLJ3zW7f8E7oT6mCROoMNWCB4TYtv041+2FMAxweiE0j7i1jubQU4MEC/Gg==",
"dependencies": {
"@tannin/evaluate": "^1.2.0",
"@tannin/postfix": "^1.1.0"
}
},
"node_modules/@tannin/evaluate": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@tannin/evaluate/-/evaluate-1.2.0.tgz",
"integrity": "sha512-3ioXvNowbO/wSrxsDG5DKIMxC81P0QrQTYai8zFNY+umuoHWRPbQ/TuuDEOju9E+jQDXmj6yI5GyejNuh8I+eg=="
},
"node_modules/@tannin/plural-forms": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/plural-forms/-/plural-forms-1.1.0.tgz",
"integrity": "sha512-xl9R2mDZO/qiHam1AgMnAES6IKIg7OBhcXqy6eDsRCdXuxAFPcjrej9HMjyCLE0DJ/8cHf0i5OQTstuBRhpbHw==",
"dependencies": {
"@tannin/compile": "^1.1.0"
}
},
"node_modules/@tannin/postfix": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/postfix/-/postfix-1.1.0.tgz",
"integrity": "sha512-oocsqY7g0cR+Gur5jRQLSrX2OtpMLMse1I10JQBm8CdGMrDkh1Mg2gjsiquMHRtBs4Qwu5wgEp5GgIYHk4SNPw=="
},
"node_modules/@types/component-emitter": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
@ -93,6 +134,61 @@
"integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA==",
"dev": true
},
"node_modules/@wordpress/api-fetch": {
"version": "6.40.0",
"resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.40.0.tgz",
"integrity": "sha512-sNk6vZW02ldci1EpNIjmm61323x/0n2Ra/cDHuehZf8avOH/OV0zF0dXxttT8M9Fncz+XZDSIHopm76dU3Phug==",
"dependencies": {
"@babel/runtime": "^7.16.0",
"@wordpress/i18n": "^4.43.0",
"@wordpress/url": "^3.44.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@wordpress/hooks": {
"version": "3.43.0",
"resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.43.0.tgz",
"integrity": "sha512-SHSiyFUEsggihl0pDvY1l72q+fHMDyFHtIR3GCt0uV2ifctvoa/PIYdVwrxpGQaGdNEV25XCZ4kNldqJmfTddw==",
"dependencies": {
"@babel/runtime": "^7.16.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@wordpress/i18n": {
"version": "4.43.0",
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.43.0.tgz",
"integrity": "sha512-XHU/vGgI+pgjJU9WzWDHke1u948z8i3OPpKUNdxc/gMcTkKaKM4D8DW1+VMSQHyU6pneP8+ph7EF+1RIehP3lQ==",
"dependencies": {
"@babel/runtime": "^7.16.0",
"@wordpress/hooks": "^3.43.0",
"gettext-parser": "^1.3.1",
"memize": "^2.1.0",
"sprintf-js": "^1.1.1",
"tannin": "^1.2.0"
},
"bin": {
"pot-to-php": "tools/pot-to-php.js"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@wordpress/url": {
"version": "3.44.0",
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.44.0.tgz",
"integrity": "sha512-QNtTPFg/cGHTJLOvOtQCvCgn5quFQgJml8A88I05o4dyUH/tc92rb8LNXi0qcVz/z4JPrx2g3+Ki8heYellP4A==",
"dependencies": {
"@babel/runtime": "^7.16.0",
"remove-accents": "^0.5.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@ -969,6 +1065,25 @@
"node": ">= 0.8"
}
},
"node_modules/encoding": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
"dependencies": {
"iconv-lite": "^0.6.2"
}
},
"node_modules/encoding/node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/engine.io": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz",
@ -1295,6 +1410,15 @@
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/gettext-parser": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz",
"integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==",
"dependencies": {
"encoding": "^0.1.12",
"safe-buffer": "^5.1.1"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
@ -1638,6 +1762,11 @@
"integrity": "sha512-7FGG40uhC8Mm633uKW1r58aElFlBlxCrg9JfSi3P6aYiWmfiWF0PgMd86ZUsxE5GwWPdHoS2+48bwTh2VPkIQA==",
"dev": true
},
"node_modules/memize": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/memize/-/memize-2.1.0.tgz",
"integrity": "sha512-yywVJy8ctVlN5lNPxsep5urnZ6TTclwPEyigM9M3Bi8vseJBOfqNrGWN/r8NzuIt3PovM323W04blJfGQfQSVg=="
},
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@ -2193,12 +2322,22 @@
"node": ">=8.10.0"
}
},
"node_modules/regenerator-runtime": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz",
"integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA=="
},
"node_modules/regex-parser": {
"version": "2.2.11",
"resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz",
"integrity": "sha512-jbD/FT0+9MBU2XAZluI7w2OBs1RBi6p9M83nkoZayQXXU9e8Robt69FcZc7wU4eJD/YFTjn1JdCk3rbMJajz8Q==",
"dev": true
},
"node_modules/remove-accents": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz",
"integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A=="
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@ -2440,14 +2579,12 @@
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/send": {
"version": "0.16.2",
@ -2808,6 +2945,11 @@
"integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==",
"dev": true
},
"node_modules/sprintf-js": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA=="
},
"node_modules/statuses": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz",
@ -2947,6 +3089,14 @@
"node": ">=10.13.0"
}
},
"node_modules/tannin": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/tannin/-/tannin-1.2.0.tgz",
"integrity": "sha512-U7GgX/RcSeUETbV7gYgoz8PD7Ni4y95pgIP/Z6ayI3CfhSujwKEBlGFTCRN+Aqnuyf4AN2yHL+L8x+TCGjb9uA==",
"dependencies": {
"@tannin/plural-forms": "^1.1.0"
}
},
"node_modules/tfunk": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tfunk/-/tfunk-4.0.0.tgz",
@ -3279,6 +3429,14 @@
}
},
"dependencies": {
"@babel/runtime": {
"version": "7.23.2",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz",
"integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==",
"requires": {
"regenerator-runtime": "^0.14.0"
}
},
"@jeffreyvr/tailwindcss-tailpress": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@jeffreyvr/tailwindcss-tailpress/-/tailwindcss-tailpress-2.0.0.tgz",
@ -3317,6 +3475,33 @@
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==",
"dev": true
},
"@tannin/compile": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/compile/-/compile-1.1.0.tgz",
"integrity": "sha512-n8m9eNDfoNZoxdvWiTfW/hSPhehzLJ3zW7f8E7oT6mCROoMNWCB4TYtv041+2FMAxweiE0j7i1jubQU4MEC/Gg==",
"requires": {
"@tannin/evaluate": "^1.2.0",
"@tannin/postfix": "^1.1.0"
}
},
"@tannin/evaluate": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@tannin/evaluate/-/evaluate-1.2.0.tgz",
"integrity": "sha512-3ioXvNowbO/wSrxsDG5DKIMxC81P0QrQTYai8zFNY+umuoHWRPbQ/TuuDEOju9E+jQDXmj6yI5GyejNuh8I+eg=="
},
"@tannin/plural-forms": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/plural-forms/-/plural-forms-1.1.0.tgz",
"integrity": "sha512-xl9R2mDZO/qiHam1AgMnAES6IKIg7OBhcXqy6eDsRCdXuxAFPcjrej9HMjyCLE0DJ/8cHf0i5OQTstuBRhpbHw==",
"requires": {
"@tannin/compile": "^1.1.0"
}
},
"@tannin/postfix": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@tannin/postfix/-/postfix-1.1.0.tgz",
"integrity": "sha512-oocsqY7g0cR+Gur5jRQLSrX2OtpMLMse1I10JQBm8CdGMrDkh1Mg2gjsiquMHRtBs4Qwu5wgEp5GgIYHk4SNPw=="
},
"@types/component-emitter": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
@ -3341,6 +3526,46 @@
"integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA==",
"dev": true
},
"@wordpress/api-fetch": {
"version": "6.40.0",
"resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.40.0.tgz",
"integrity": "sha512-sNk6vZW02ldci1EpNIjmm61323x/0n2Ra/cDHuehZf8avOH/OV0zF0dXxttT8M9Fncz+XZDSIHopm76dU3Phug==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/i18n": "^4.43.0",
"@wordpress/url": "^3.44.0"
}
},
"@wordpress/hooks": {
"version": "3.43.0",
"resolved": "https://registry.npmjs.org/@wordpress/hooks/-/hooks-3.43.0.tgz",
"integrity": "sha512-SHSiyFUEsggihl0pDvY1l72q+fHMDyFHtIR3GCt0uV2ifctvoa/PIYdVwrxpGQaGdNEV25XCZ4kNldqJmfTddw==",
"requires": {
"@babel/runtime": "^7.16.0"
}
},
"@wordpress/i18n": {
"version": "4.43.0",
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.43.0.tgz",
"integrity": "sha512-XHU/vGgI+pgjJU9WzWDHke1u948z8i3OPpKUNdxc/gMcTkKaKM4D8DW1+VMSQHyU6pneP8+ph7EF+1RIehP3lQ==",
"requires": {
"@babel/runtime": "^7.16.0",
"@wordpress/hooks": "^3.43.0",
"gettext-parser": "^1.3.1",
"memize": "^2.1.0",
"sprintf-js": "^1.1.1",
"tannin": "^1.2.0"
}
},
"@wordpress/url": {
"version": "3.44.0",
"resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.44.0.tgz",
"integrity": "sha512-QNtTPFg/cGHTJLOvOtQCvCgn5quFQgJml8A88I05o4dyUH/tc92rb8LNXi0qcVz/z4JPrx2g3+Ki8heYellP4A==",
"requires": {
"@babel/runtime": "^7.16.0",
"remove-accents": "^0.5.0"
}
},
"accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@ -3997,6 +4222,24 @@
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
"dev": true
},
"encoding": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
"requires": {
"iconv-lite": "^0.6.2"
},
"dependencies": {
"iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
}
}
}
},
"engine.io": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.0.tgz",
@ -4247,6 +4490,15 @@
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true
},
"gettext-parser": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/gettext-parser/-/gettext-parser-1.4.0.tgz",
"integrity": "sha512-sedZYLHlHeBop/gZ1jdg59hlUEcpcZJofLq2JFwJT1zTqAU3l2wFv6IsuwFHGqbiT9DWzMUW4/em2+hspnmMMA==",
"requires": {
"encoding": "^0.1.12",
"safe-buffer": "^5.1.1"
}
},
"glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
@ -4516,6 +4768,11 @@
"integrity": "sha512-7FGG40uhC8Mm633uKW1r58aElFlBlxCrg9JfSi3P6aYiWmfiWF0PgMd86ZUsxE5GwWPdHoS2+48bwTh2VPkIQA==",
"dev": true
},
"memize": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/memize/-/memize-2.1.0.tgz",
"integrity": "sha512-yywVJy8ctVlN5lNPxsep5urnZ6TTclwPEyigM9M3Bi8vseJBOfqNrGWN/r8NzuIt3PovM323W04blJfGQfQSVg=="
},
"merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@ -4898,12 +5155,22 @@
"picomatch": "^2.2.1"
}
},
"regenerator-runtime": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz",
"integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA=="
},
"regex-parser": {
"version": "2.2.11",
"resolved": "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz",
"integrity": "sha512-jbD/FT0+9MBU2XAZluI7w2OBs1RBi6p9M83nkoZayQXXU9e8Robt69FcZc7wU4eJD/YFTjn1JdCk3rbMJajz8Q==",
"dev": true
},
"remove-accents": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz",
"integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A=="
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@ -5092,14 +5359,12 @@
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"send": {
"version": "0.16.2",
@ -5393,6 +5658,11 @@
"integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==",
"dev": true
},
"sprintf-js": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA=="
},
"statuses": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz",
@ -5491,6 +5761,14 @@
}
}
},
"tannin": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/tannin/-/tannin-1.2.0.tgz",
"integrity": "sha512-U7GgX/RcSeUETbV7gYgoz8PD7Ni4y95pgIP/Z6ayI3CfhSujwKEBlGFTCRN+Aqnuyf4AN2yHL+L8x+TCGjb9uA==",
"requires": {
"@tannin/plural-forms": "^1.1.0"
}
},
"tfunk": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tfunk/-/tfunk-4.0.0.tgz",

View File

@ -45,5 +45,8 @@
"postcss-nested-ancestors": "^2.0.0",
"resolve-url-loader": "^3.1.2",
"tailwindcss": "^3.1.0"
},
"dependencies": {
"@wordpress/api-fetch": "^6.40.0"
}
}

View File

@ -1,16 +1,17 @@
<?php get_header(); ?>
<div class="page-content">
<?php if (have_posts()) : ?>
<?php
while (have_posts()) :
the_post();
the_content();
?>
<?php if (have_posts()) : ?>
<?php
while (have_posts()) :
the_post();
the_content();
?>
<?php endwhile; ?>
<?php endwhile; ?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php get_footer();

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="7.459" height="10.613" viewBox="0 0 7.459 10.613">
<g id="Groupe_5602" data-name="Groupe 5602" transform="translate(2.083 1.403)">
<path id="Tracé_162" data-name="Tracé 162" d="M104.818,77.949l5.056-3.9-5.056-3.9" transform="translate(-105.498 -70.142)" fill="none" stroke="#df1e1e" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 418 B

View File

@ -2,6 +2,7 @@ import editorInit from './editor';
import menuInit from './menus';
import singleConseil from './single-conseil';
import SchemaBulletPointsInit from './schema-bullet-points';
import taxonomyThematiqueFaqInit from './taxonomy-thematique-(faq)';
// window.addEventListener('load', function () {});
window.addEventListener('DOMContentLoaded', (event) => {
@ -9,4 +10,5 @@ window.addEventListener('DOMContentLoaded', (event) => {
SchemaBulletPointsInit();
singleConseil();
editorInit();
taxonomyThematiqueFaqInit();
});

View File

@ -19,7 +19,7 @@ export default function SchemaBulletPointsInit() {
focusPointPopupContainer.style.top = `${focusPointPosition.y}%`;
focusPointPopupContainer.appendChild(focusPointPopupTitle);
console.log(focusPointPosition);
// console.log(focusPointPosition);
// focusPointPopupContainer.style.left = `${focusPoint.getAttribute}px`;
// focusPoint.appendChild(focusPointPopupContainer);
@ -39,8 +39,8 @@ export default function SchemaBulletPointsInit() {
const aspect = entry.intersectionRatio > 0;
if (entry.isIntersecting) {
console.log(entry.target);
console.log(entry.intersectionRatio);
// console.log(entry.target);
// console.log(entry.intersectionRatio);
// Add 'active' class if observation target is inside viewport
// entry.target.classList.add('active');
// const blockId = entry.target.getAttribute('id');

View File

@ -0,0 +1,62 @@
async function fetchMoreThematiquePostDatas() {
// const response = await fetch('/wp-json/wp/v2/questions?per_page=100');
const response = await fetch('/wp-json/wp/v2/questions?thematiques=41');
const data = await response.json();
console.log(data);
return data;
}
async function handleLoadMoreClick() {
const posts = await fetchMoreThematiquePostDatas();
const postsContainer = document.querySelector('.post-question-page__accordeons-container');
console.log(mainAppJsDynamicDatas.current_thematique);
posts.forEach((post) => {
let newContent = createDetailsElement(post);
postsContainer.appendChild(newContent);
});
}
function createDetailsElement(post) {
const details = document.createElement('details');
details.classList.add('question');
const summary = document.createElement('summary');
summary.textContent = post.title.rendered;
const openCloseIcon = document.createElement('div');
openCloseIcon.classList.add('open-close-icon');
const chevron = document.createElement('img');
chevron.src =
mainAppJsDynamicDatas.template_directory_uri + '/resources/img/graphic-assets/chevron_down.svg';
const content = document.createElement('div');
content.classList.add('content', 'entry-content');
content.innerHTML = post.content.rendered;
details.appendChild(summary);
openCloseIcon.appendChild(chevron);
details.appendChild(openCloseIcon);
details.appendChild(content);
return details;
}
export default async function taxonomyThematiqueFaqInit() {
console.log(mainAppJsDynamicDatas);
const currentQuestionPage = document.querySelector('.post-question-page');
const filters = document.querySelectorAll('.thematiques-subtaxonomy-links li');
if (!currentQuestionPage) return;
const loadMoreButton = document.querySelector('#load-more-questions');
loadMoreButton.addEventListener('click', handleLoadMoreClick);
filters.forEach((filter) => {
filter.addEventListener('click', (e) => {
e.preventDefault;
console.log(fetchPostDatas);
});
});
}

View File

@ -2,6 +2,7 @@
get_header();
?>
<?php if (have_posts()) : ?>
<?php
while (have_posts()) :

View File

@ -57,62 +57,63 @@ $relatedTaxQuestions = new WP_Query($query_args);
</ol>
</nav>
<div class="post-question-page <?php echo $thematiqueColorSlug ? "post-question-page--" . $mainThematique->slug : "" ?>"">
<div class="post-question-page <?php echo $thematiqueColorSlug ? "post-question-page--" . $mainThematique->slug : "" ?>"" data-thematique-id=" <?php echo $currentThematique->term_id ?>">
<?php get_template_part(
'template-components/posts-components/chapter-header',
null,
array(
'ID' => get_queried_object_id(),
'title' => __("Les questions les plus fréquentes sur ", "homegrade-theme__texte-fonctionnel__faq-archive-questions") . get_queried_object()->name,
'sub-title' => $currentThematique->name,
'thematique' => $currentThematique,
'thematique_generale' => $mainThematique,
'thematiqueColorSlug' => $thematiqueColorSlug,
)
<?php get_template_part(
'template-components/posts-components/chapter-header',
null,
array(
'ID' => get_queried_object_id(),
'title' => __("Les questions les plus fréquentes sur ", "homegrade-theme__texte-fonctionnel__faq-archive-questions") . get_queried_object()->name,
'sub-title' => $currentThematique->name,
'thematique' => $currentThematique,
'thematique_generale' => $mainThematique,
'thematiqueColorSlug' => $thematiqueColorSlug,
)
); ?>
<section class=" post-question-page__accordeons-container ">
<?php if ($mainThematique && $sousThematiques) : ?>
<div class=" thematiques_filters">
); ?>
<section class=" post-question-page__accordeons-container ">
<?php if ($mainThematique && $sousThematiques) : ?>
<div class=" thematiques_filters">
<nav class="thematiques-subtaxonomy-links" aria-label="breadcrumbs">
<h3><?php echo __("Filtrer par catégories", $theme_namespace) ?></h3>
<ul>
<?php foreach ($sousThematiques as $sousThematique) : ?>
<li data-filter="<?php echo $sousThematique->slug ?>">
<a class="cta cta--outline cta--button text-<?php echo $currentThematique->slug ?>" href="<?php echo get_term_link($sousThematique) ?>" <?php echo $sousThematique == get_queried_object() ? "aria-current='location'" : "" ?>><?php echo $sousThematique->name ?></a>
</li>
<?php endforeach; ?>
</ul>
<h2 aria-live=" polite"><?php echo __("Nombre de résultats", 'homegrade-theme__texte-fonctionnel') . " : " . count($relatedTaxQuestions->posts) ?></h2>
</nav>
<nav class="thematiques-subtaxonomy-links" aria-label="breadcrumbs">
<h3><?php echo __("Filtrer par catégories", $theme_namespace) ?></h3>
<ul>
<?php foreach ($sousThematiques as $sousThematique) : ?>
<li data-filter="<?php echo $sousThematique->slug ?>">
<button class="cta cta--outline cta--button text-<?php echo $currentThematique->slug ?>"><?php echo $currentThematique->slug ?></button>
<!-- <a class="cta cta--outline cta--button text-<?php echo $currentThematique->slug ?>" href="<?php echo get_term_link($sousThematique) ?>" <?php echo $sousThematique == get_queried_object() ? "aria-current='location'" : "" ?>><?php echo $sousThematique->name ?></a> -->
</li>
<?php endforeach; ?>
</ul>
<h2 aria-live=" polite"><?php echo __("Nombre de résultats", 'homegrade-theme__texte-fonctionnel') . " : " . count($relatedTaxQuestions->posts) ?></h2>
</nav>
</div>
<?php endif; ?>
<?php if ($relatedTaxQuestions->have_posts()) : while ($relatedTaxQuestions->have_posts()) : $relatedTaxQuestions->the_post(); ?>
<details class=" question">
<summary>
<?php the_title(); ?>
<div class="open-close-icon">
<img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/chevron_down.svg' ?>" class="open-close-cta" alt="" />
</div>
</summary>
<div class="content entry-content">
<?php the_content(); ?>
</div>
</details>
<?php endif; ?>
<?php endwhile ?>
<?php endif; ?>
<?php if ($currentThematiqueIsParent) : ?>
<p><?php echo $currentThematiqueIsParent['title'] ?></p>
<button><?php echo __("Charger plus de questions", $theme_namespace) ?></button>
<?php endif; ?>
</section>
<?php if ($relatedTaxQuestions->have_posts()) : while ($relatedTaxQuestions->have_posts()) : $relatedTaxQuestions->the_post(); ?>
<details class=" question">
<summary>
<?php the_title(); ?>
<div class="open-close-icon">
<img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/chevron_down.svg' ?>" class="open-close-cta" alt="" />
</div>
</summary>
<div class="content entry-content">
<?php the_content(); ?>
</div>
</details>
<?php endwhile ?>
<?php endif; ?>
</section>
<?php if ($currentThematiqueIsParent) : ?>
<p><?php echo $currentThematiqueIsParent['title'] ?></p>
<button id="load-more-questions"><?php echo __("Charger plus de questions", $theme_namespace) ?></button>
<?php endif; ?>
</div>