From 4fcf41543a51691a659415be7042be04e52976d9 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Sat, 12 Aug 2023 10:50:39 +0200 Subject: [PATCH] srtting up ajax, building chapter index for conseils, declaring post type fiches-infos --- css/admin-style.css | 88 +-- css/app.css | 506 +++++++++++------- functions.php | 1 + header.php | 10 +- includes/admin.php | 78 +++ includes/ajax.php | 125 +++++ includes/blocks.php | 4 +- includes/init.php | 2 +- includes/post_types.php | 62 +-- js/app.js | 24 + resources/css/admin-style.css | 65 --- resources/css/app.css | 15 +- resources/css/blocks/chapter-header-block.css | 2 +- resources/css/components/section-titling.css | 14 +- .../editor-content/color-taxonomy-scheme.css | 87 +++ resources/css/editor-content/gutenberg.css | 49 ++ resources/css/layout/gutenberg.css | 110 ---- resources/css/pages/single-conseils.css | 31 ++ resources/js/ajax.js | 40 ++ resources/js/app.js | 2 + resources/js/single-conseil.js | 32 ++ single-conseils.php | 61 +++ single.php | 1 - .../home/latest-news/latest-news.php | 2 +- .../questions-frequentes.php | 2 +- .../show-thematiques/show-thematiques.php | 2 +- .../archives/brochure-grid-row.php | 25 + .../{ => cards}/card-frequent-question.php | 0 .../{ => cards}/card-frequent_question.css | 0 template-components/{ => cards}/card-news.css | 0 template-components/{ => cards}/card-news.php | 0 .../{ => cards}/card-thematique.css | 0 .../{ => cards}/card-thematique.php | 0 .../post-conseils/chapter-header.css | 27 + .../post-conseils/chapter-header.php | 53 ++ template-components/salut.php | 4 + template-conseils.php | 10 +- template-publications.php | 125 ++++- 38 files changed, 1127 insertions(+), 532 deletions(-) create mode 100644 includes/ajax.php create mode 100644 resources/css/editor-content/color-taxonomy-scheme.css create mode 100644 resources/css/editor-content/gutenberg.css delete mode 100644 resources/css/layout/gutenberg.css create mode 100644 resources/css/pages/single-conseils.css create mode 100644 resources/js/ajax.js create mode 100644 resources/js/single-conseil.js create mode 100644 single-conseils.php create mode 100644 template-components/archives/brochure-grid-row.php rename template-components/{ => cards}/card-frequent-question.php (100%) rename template-components/{ => cards}/card-frequent_question.css (100%) rename template-components/{ => cards}/card-news.css (100%) rename template-components/{ => cards}/card-news.php (100%) rename template-components/{ => cards}/card-thematique.css (100%) rename template-components/{ => cards}/card-thematique.php (100%) create mode 100644 template-components/post-conseils/chapter-header.css create mode 100644 template-components/post-conseils/chapter-header.php create mode 100644 template-components/salut.php diff --git a/css/admin-style.css b/css/admin-style.css index cadf3c1..f0ab37e 100644 --- a/css/admin-style.css +++ b/css/admin-style.css @@ -22,90 +22,4 @@ .block-editor-block-list__block { background-color: yellow !imporatant; */ -/* } */ - -body.acoustique-coproprietes h2, - body.acoustique-coproprietes h3 { - --tw-text-opacity: 1; - color: rgb(36 94 242 / var(--tw-text-opacity)); -} - -body.acoustique-coproprietes ul li::marker { - --tw-text-opacity: 1; - color: rgb(36 94 242 / var(--tw-text-opacity)); -} - -body.acoustique-coproprietes .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(223 241 255 / var(--tw-bg-opacity)); -} - -body.energies-urbanisme h2, - body.energies-urbanisme h3 { - --tw-text-opacity: 1; - color: rgb(2 126 80 / var(--tw-text-opacity)); -} - -body.energies-urbanisme ul li::marker { - --tw-text-opacity: 1; - color: rgb(2 126 80 / var(--tw-text-opacity)); -} - -body.energies-urbanisme .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(227 255 240 / var(--tw-bg-opacity)); -} - -body.isolation-quotidien h2, - body.isolation-quotidien h3 { - --tw-text-opacity: 1; - color: rgb(194 69 3 / var(--tw-text-opacity)); -} - -body.isolation-quotidien ul li::before { - --tw-bg-opacity: 1; - background-color: rgb(194 69 3 / var(--tw-bg-opacity)); -} - -body.isolation-quotidien ul li::marker { - --tw-text-opacity: 1; - color: rgb(194 69 3 / var(--tw-text-opacity)); -} - -body.isolation-quotidien .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(255 251 236 / var(--tw-bg-opacity)); -} - -body.patrimoine-renovation h1, - body.patrimoine-renovation h2, - body.patrimoine-renovation h3 { - --tw-text-opacity: 1; - color: rgb(139 47 247 / var(--tw-text-opacity)); -} - -body.patrimoine-renovation ul li::marker { - --tw-text-opacity: 1; - color: rgb(139 47 247 / var(--tw-text-opacity)); -} - -body.patrimoine-renovation .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(255 229 253 / var(--tw-bg-opacity)); -} - -body.location h2, - body.location h3 { - --tw-text-opacity: 1; - color: rgb(223 0 43 / var(--tw-text-opacity)); -} - -body.location ul li::marker { - --tw-text-opacity: 1; - color: rgb(223 0 43 / var(--tw-text-opacity)); -} - -body.location .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(254 226 231 / var(--tw-bg-opacity)); -} +/* } */ diff --git a/css/app.css b/css/app.css index ad07d88..c828414 100644 --- a/css/app.css +++ b/css/app.css @@ -1444,10 +1444,6 @@ button:focus { text-align: center; } -.section_titling--left { - text-align: left; -} - .section_titling__title { padding-bottom: 0.5rem; font-size: 1.25rem; @@ -1458,11 +1454,6 @@ button:focus { color: rgb(223 30 30 / var(--tw-text-opacity)); } -.section_titling.section_titling--left { - --tw-bg-opacity: 1; - background-color: rgb(250 204 21 / var(--tw-bg-opacity)); -} - .section_titling__subtitle { margin-left: auto; margin-right: auto; @@ -1483,6 +1474,14 @@ button:focus { line-height: 1.75rem; } +.section_titling--left { + text-align: left; +} + +.section_titling--left .section_titling__subtitle { + margin-left: 0px; +} + .content-intertitle { padding-bottom: 0.25rem; font-size: 1.125rem; @@ -2077,6 +2076,56 @@ button:focus { hue-rotate(263deg) brightness(99%) contrast(96%); } +.post-conseils-chapter-header { + margin-left: auto; + margin-right: auto; + margin-top: 2rem; + display: flex; + max-width: 1440px; + align-content: space-between; + align-items: center; + border-radius: 1rem; + padding: 2rem; +} + +@media (min-width: 782px) { + .post-conseils-chapter-header { + padding-left: 4rem; + padding-right: 4rem; + } +} + +.post-conseils-chapter-header { + margin-bottom: 20px; +} + +.post-conseils-chapter-header__page-thematic-cover { + max-width: 400px; +} + +.post-conseils-chapter-header__page-thematic-title { + padding-bottom: 1rem; + font-size: 1.25rem; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.05em; +} + +.post-conseils-chapter-header__page-title { + font-size: 2.25rem; + line-height: 2.5rem; + font-weight: 700; +} + +.post-conseils-chapter-header__infos { + max-width: 42rem; +} + +.post-conseils-chapter-header__infos .cta { + margin-top: 2rem; + margin-bottom: 2rem; +} + /* ########### LAYOUT ############ */ header#main-header { @@ -2243,145 +2292,6 @@ header#main-header { } } -article > *:not(.entry-content, .chapter-header-block), -.entry-content > * { - margin-left: auto; - margin-right: auto; - max-width: 960px; -} - -.entry-content--acoustique-coproprietes h2, - .entry-content--acoustique-coproprietes h3 { - --tw-text-opacity: 1; - color: rgb(36 94 242 / var(--tw-text-opacity)); -} - -.entry-content--acoustique-coproprietes ul li::marker { - --tw-text-opacity: 1; - color: rgb(36 94 242 / var(--tw-text-opacity)); -} - -.entry-content--acoustique-coproprietes .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(223 241 255 / var(--tw-bg-opacity)); -} - -.entry-content--energies-urbanisme h2, - .entry-content--energies-urbanisme h3 { - --tw-text-opacity: 1; - color: rgb(2 126 80 / var(--tw-text-opacity)); -} - -.entry-content--energies-urbanisme ul li::marker { - --tw-text-opacity: 1; - color: rgb(2 126 80 / var(--tw-text-opacity)); -} - -.entry-content--energies-urbanisme .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(227 255 240 / var(--tw-bg-opacity)); -} - -.entry-content--isolation-quotidien h2, - .entry-content--isolation-quotidien h3 { - --tw-text-opacity: 1; - color: rgb(194 69 3 / var(--tw-text-opacity)); -} - -.entry-content--isolation-quotidien ul li::marker { - --tw-text-opacity: 1; - color: rgb(194 69 3 / var(--tw-text-opacity)); -} - -.entry-content--isolation-quotidien .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(255 251 236 / var(--tw-bg-opacity)); -} - -.entry-content--patrimoine-renovation h1, - .entry-content--patrimoine-renovation h2, - .entry-content--patrimoine-renovation h3 { - --tw-text-opacity: 1; - color: rgb(139 47 247 / var(--tw-text-opacity)); -} - -.entry-content--patrimoine-renovation ul li::marker { - --tw-text-opacity: 1; - color: rgb(139 47 247 / var(--tw-text-opacity)); -} - -.entry-content--patrimoine-renovation .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(255 229 253 / var(--tw-bg-opacity)); -} - -.entry-content--location h2, - .entry-content--location h3 { - --tw-text-opacity: 1; - color: rgb(223 0 43 / var(--tw-text-opacity)); -} - -.entry-content--location ul li::marker { - --tw-text-opacity: 1; - color: rgb(223 0 43 / var(--tw-text-opacity)); -} - -.entry-content--location .homegrade-blocks-highlight { - --tw-bg-opacity: 1; - background-color: rgb(254 226 231 / var(--tw-bg-opacity)); -} - -.entry-content h1 { - font-size: 1.5rem; - line-height: 2rem; -} - -.entry-content h2 { - font-size: 1.25rem; -} - -.entry-content h3 { - font-size: 1.5rem; - line-height: 2rem; - font-weight: 700; -} - -.entry-content p a, .entry-content ul a, .entry-content ol a { - font-weight: 700; - --tw-text-opacity: 1; - color: rgb(47 1 84 / var(--tw-text-opacity)); - -webkit-text-decoration-line: underline; - text-decoration-line: underline; - text-underline-offset: 4px; -} - -/* &:after { - @apply inline-block bg-red-500 h-3 w-3 ml-2; - content: ''; - background-image: url('/wp-content/themes/homegrade/dist/images/arrow.svg'); - } */ - -.entry-content p a:hover, .entry-content ul a:hover, .entry-content ol a:hover { - -webkit-text-decoration-line: none; - text-decoration-line: none; -} - -.entry-content p, - .entry-content ul, - .entry-content ol { - margin-bottom: 2rem; -} - -.entry-content ul:not(.block-editor-block-variation-picker__variations) li { - list-style-position: inside; - list-style-type: disc; -} - -.entry-content ol li { - list-style-position: inside; - list-style-type: decimal; -} - .menu-renovateur { position: relative; display: flex; @@ -3590,39 +3500,7 @@ article > *:not(.entry-content, .chapter-header-block), /* ########### ADD STYLE LAYER TO CONTENT BLOCKS (FROM PLUGIN) ############ */ -.chapter-header-block { - padding: 2rem; -} - -@media (min-width: 782px) { - .chapter-header-block { - padding-left: 4rem; - padding-right: 4rem; - } -} - -.chapter-header-block__page-thematic-title { - padding-bottom: 1rem; - font-size: 1.25rem; - font-weight: 700; - text-transform: uppercase; - letter-spacing: 0.05em; -} - -.chapter-header-block__page-title { - font-size: 2.25rem; - line-height: 2.5rem; - font-weight: 700; -} - -.chapter-header-block__infos { - max-width: 42rem; -} - -.chapter-header-block__infos .cta { - margin-top: 2rem; - margin-bottom: 2rem; -} +/* @import './blocks/chapter-header-block.css'; */ .questions-container-block h2 { font-size: 2.25rem; @@ -3723,6 +3601,272 @@ article > *:not(.entry-content, .chapter-header-block), } } +.post-conseil-page-container { + padding-left: 2rem; + padding-right: 2rem; +} + +.conseils_wrapper { + margin-left: auto; + margin-right: auto; + display: flex; + max-width: 1440px; + -moz-column-gap: 2rem; + column-gap: 2rem; +} + +.conseils_wrapper .chapter_index { + position: -webkit-sticky; + position: sticky; + left: 0px; + top: 1rem; + height: -webkit-fit-content; + height: -moz-fit-content; + height: fit-content; + max-width: 32rem; + border-radius: 1rem; + background-color: rgb(239, 239, 239, 0.6); + padding: 3rem; +} + +.conseils_wrapper .chapter_index__title { + margin-bottom: 0.75rem; + font-size: 1.25rem; + font-weight: 700; +} + +.conseils_wrapper .chapter_index__list { + position: relative; +} + +.conseils_wrapper .chapter_index__position-indicator { + position: absolute; + top: 0px; + left: -1rem; + height: 2rem; + border-radius: 1rem; + width: 3px; +} + +.conseils_wrapper .chapter_index a { + display: block; +} + +/* ###### EDITOR ##### */ + +.entry-content--acoustique-coproprietes h2, + .entry-content--acoustique-coproprietes h3, + .entry-content--acoustique-coproprietes ul li::marker, + body.acoustique-coproprietes h2, + body.acoustique-coproprietes h3, + body.acoustique-coproprietes ul li::marker, + .post-conseil-page--acoustique-coproprietes h2, + .post-conseil-page--acoustique-coproprietes h3, + .post-conseil-page--acoustique-coproprietes ul li::marker { + --tw-text-opacity: 1; + color: rgb(36 94 242 / var(--tw-text-opacity)); +} + +.entry-content--acoustique-coproprietes .homegrade-blocks-highlight, + .entry-content--acoustique-coproprietes .homegrade-blocks-chapter-header-block, + .entry-content--acoustique-coproprietes .post-conseils-chapter-header, + body.acoustique-coproprietes .homegrade-blocks-highlight, + body.acoustique-coproprietes .homegrade-blocks-chapter-header-block, + body.acoustique-coproprietes .post-conseils-chapter-header, + .post-conseil-page--acoustique-coproprietes .homegrade-blocks-highlight, + .post-conseil-page--acoustique-coproprietes .homegrade-blocks-chapter-header-block, + .post-conseil-page--acoustique-coproprietes .post-conseils-chapter-header { + --tw-bg-opacity: 1; + background-color: rgb(223 241 255 / var(--tw-bg-opacity)); +} + +.entry-content--acoustique-coproprietes .chapter_index__position-indicator, body.acoustique-coproprietes .chapter_index__position-indicator, .post-conseil-page--acoustique-coproprietes .chapter_index__position-indicator { + --tw-bg-opacity: 1; + background-color: rgb(36 94 242 / var(--tw-bg-opacity)); +} + +.entry-content--energies-urbanisme h2, + .entry-content--energies-urbanisme h3, + .entry-content--energies-urbanisme ul li::marker, + body.energies-urbanisme h2, + body.energies-urbanisme h3, + body.energies-urbanisme ul li::marker, + .post-conseil-page--energies-urbanisme h2, + .post-conseil-page--energies-urbanisme h3, + .post-conseil-page--energies-urbanisme ul li::marker { + --tw-text-opacity: 1; + color: rgb(2 126 80 / var(--tw-text-opacity)); +} + +.entry-content--energies-urbanisme .homegrade-blocks-highlight, + .entry-content--energies-urbanisme .homegrade-blocks-chapter-header-block, + .entry-content--energies-urbanisme .post-conseils-chapter-header, + body.energies-urbanisme .homegrade-blocks-highlight, + body.energies-urbanisme .homegrade-blocks-chapter-header-block, + body.energies-urbanisme .post-conseils-chapter-header, + .post-conseil-page--energies-urbanisme .homegrade-blocks-highlight, + .post-conseil-page--energies-urbanisme .homegrade-blocks-chapter-header-block, + .post-conseil-page--energies-urbanisme .post-conseils-chapter-header { + --tw-bg-opacity: 1; + background-color: rgb(227 255 240 / var(--tw-bg-opacity)); +} + +.entry-content--energies-urbanisme .chapter_index__position-indicator, body.energies-urbanisme .chapter_index__position-indicator, .post-conseil-page--energies-urbanisme .chapter_index__position-indicator { + --tw-bg-opacity: 1; + background-color: rgb(2 126 80 / var(--tw-bg-opacity)); +} + +.entry-content--isolation-quotidien h2, + .entry-content--isolation-quotidien h3, + .entry-content--isolation-quotidien ul li::marker, + body.isolation-quotidien h2, + body.isolation-quotidien h3, + body.isolation-quotidien ul li::marker, + .post-conseil-page--isolation-quotidien h2, + .post-conseil-page--isolation-quotidien h3, + .post-conseil-page--isolation-quotidien ul li::marker { + --tw-text-opacity: 1; + color: rgb(194 69 3 / var(--tw-text-opacity)); +} + +.entry-content--isolation-quotidien .homegrade-blocks-highlight, + .entry-content--isolation-quotidien .homegrade-blocks-chapter-header-block, + .entry-content--isolation-quotidien .post-conseils-chapter-header, + body.isolation-quotidien .homegrade-blocks-highlight, + body.isolation-quotidien .homegrade-blocks-chapter-header-block, + body.isolation-quotidien .post-conseils-chapter-header, + .post-conseil-page--isolation-quotidien .homegrade-blocks-highlight, + .post-conseil-page--isolation-quotidien .homegrade-blocks-chapter-header-block, + .post-conseil-page--isolation-quotidien .post-conseils-chapter-header { + --tw-bg-opacity: 1; + background-color: rgb(255 251 236 / var(--tw-bg-opacity)); +} + +.entry-content--isolation-quotidien .chapter_index__position-indicator, body.isolation-quotidien .chapter_index__position-indicator, .post-conseil-page--isolation-quotidien .chapter_index__position-indicator { + --tw-bg-opacity: 1; + background-color: rgb(194 69 3 / var(--tw-bg-opacity)); +} + +.entry-content--patrimoine-renovation h2, + .entry-content--patrimoine-renovation h3, + .entry-content--patrimoine-renovation ul li::marker, + body.patrimoine-renovation h2, + body.patrimoine-renovation h3, + body.patrimoine-renovation ul li::marker, + .post-conseil-page--patrimoine-renovation h2, + .post-conseil-page--patrimoine-renovation h3, + .post-conseil-page--patrimoine-renovation ul li::marker { + --tw-text-opacity: 1; + color: rgb(139 47 247 / var(--tw-text-opacity)); +} + +.entry-content--patrimoine-renovation .homegrade-blocks-highlight, + .entry-content--patrimoine-renovation .homegrade-blocks-chapter-header-block, + .entry-content--patrimoine-renovation .post-conseils-chapter-header, + body.patrimoine-renovation .homegrade-blocks-highlight, + body.patrimoine-renovation .homegrade-blocks-chapter-header-block, + body.patrimoine-renovation .post-conseils-chapter-header, + .post-conseil-page--patrimoine-renovation .homegrade-blocks-highlight, + .post-conseil-page--patrimoine-renovation .homegrade-blocks-chapter-header-block, + .post-conseil-page--patrimoine-renovation .post-conseils-chapter-header { + --tw-bg-opacity: 1; + background-color: rgb(255 229 253 / var(--tw-bg-opacity)); +} + +.entry-content--patrimoine-renovation .chapter_index__position-indicator, body.patrimoine-renovation .chapter_index__position-indicator, .post-conseil-page--patrimoine-renovation .chapter_index__position-indicator { + --tw-bg-opacity: 1; + background-color: rgb(139 47 247 / var(--tw-bg-opacity)); +} + +.entry-content--location h2, + .entry-content--location h3, + .entry-content--location ul li::marker, + body.location h2, + body.location h3, + body.location ul li::marker, + .post-conseil-page--location h2, + .post-conseil-page--location h3, + .post-conseil-page--location ul li::marker { + --tw-text-opacity: 1; + color: rgb(223 0 43 / var(--tw-text-opacity)); +} + +.entry-content--location .homegrade-blocks-highlight, + .entry-content--location .homegrade-blocks-chapter-header-block, + .entry-content--location .post-conseils-chapter-header, + body.location .homegrade-blocks-highlight, + body.location .homegrade-blocks-chapter-header-block, + body.location .post-conseils-chapter-header, + .post-conseil-page--location .homegrade-blocks-highlight, + .post-conseil-page--location .homegrade-blocks-chapter-header-block, + .post-conseil-page--location .post-conseils-chapter-header { + --tw-bg-opacity: 1; + background-color: rgb(254 226 231 / var(--tw-bg-opacity)); +} + +.entry-content--location .chapter_index__position-indicator, body.location .chapter_index__position-indicator, .post-conseil-page--location .chapter_index__position-indicator { + --tw-bg-opacity: 1; + background-color: rgb(223 0 43 / var(--tw-bg-opacity)); +} + +article > *:not(.entry-content, .chapter-header-block), +.entry-content > * { + margin-left: auto; + margin-right: auto; + max-width: 960px; +} + +.entry-content h1 { + font-size: 1.5rem; + line-height: 2rem; +} + +.entry-content h2 { + font-size: 1.25rem; +} + +.entry-content h3 { + font-size: 1.5rem; + line-height: 2rem; + font-weight: 700; +} + +.entry-content p a, .entry-content ul a, .entry-content ol a { + font-weight: 700; + --tw-text-opacity: 1; + color: rgb(47 1 84 / var(--tw-text-opacity)); + -webkit-text-decoration-line: underline; + text-decoration-line: underline; + text-underline-offset: 4px; +} + +/* &:after { + @apply inline-block bg-red-500 h-3 w-3 ml-2; + content: ''; + background-image: url('/wp-content/themes/homegrade/dist/images/arrow.svg'); + } */ + +.entry-content p a:hover, .entry-content ul a:hover, .entry-content ol a:hover { + -webkit-text-decoration-line: none; + text-decoration-line: none; +} + +.entry-content p, + .entry-content ul, + .entry-content ol { + margin-bottom: 2rem; +} + +.entry-content ul:not(.block-editor-block-variation-picker__variations) li { + list-style-position: inside; + list-style-type: disc; +} + +.entry-content ol li { + list-style-position: inside; + list-style-type: decimal; +} + .hover\:bg-primary:hover { --tw-bg-opacity: 1; background-color: rgb(47 1 84 / var(--tw-bg-opacity)); diff --git a/functions.php b/functions.php index 15051aa..cf57c08 100644 --- a/functions.php +++ b/functions.php @@ -12,6 +12,7 @@ require_once(__DIR__ . '/includes/taxonomy.php'); 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/widget.php'); // require_once( __DIR__ . '/includes/logos.php'); \ No newline at end of file diff --git a/header.php b/header.php index 44edcf9..2a8e98c 100644 --- a/header.php +++ b/header.php @@ -7,7 +7,7 @@ - + > @@ -47,4 +47,12 @@ + + slug); + ?> +
\ No newline at end of file diff --git a/includes/admin.php b/includes/admin.php index b0e4a6b..c1ed240 100644 --- a/includes/admin.php +++ b/includes/admin.php @@ -84,6 +84,38 @@ function custom_menu_page_removing() } add_action('admin_menu', 'custom_menu_page_removing'); +/* ---------------------------------- + HIDE EDITOR ON CERTAIN PAGES + -----------------------------------*/ + +function hide_editor() +{ + $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID']; + if (!isset($post_id)) return; + + $template_file = get_post_meta($post_id, '_wp_page_template', true); + + if ($template_file == 'template-publications.php') { // edit the template name + remove_post_type_support('page', 'editor', 'comments'); + } +} +add_action('admin_init', 'hide_editor'); + +function remove_meta_boxes() +{ + # Removes meta from Posts # + // remove_meta_box('postexcerpt', 'post', 'normal'); + // remove_meta_box('postcustom', 'post', 'normal'); + // remove_meta_box('trackbacksdiv', 'post', 'normal'); + remove_meta_box('commentstatusdiv', 'page', 'normal'); + remove_meta_box('commentsdiv', 'page', 'normal'); +} +add_action('admin_init', 'remove_meta_boxes'); + + + + + /* ---------------------------------- REMOVE FROM ADMIN BAR -----------------------------------*/ @@ -166,3 +198,49 @@ function wpdocs_admin_classes($classes) } add_filter('admin_body_class', 'wpdocs_admin_classes'); + + + + + +/* ---------------------------------------------------------------------- + REORDER ADMIN MENU & POST TYPE ORDER ON MENU BAR + ------------------------------------------------------------------------*/ +/** + * Activates the 'menu_order' filter and then hooks into 'menu_order' + */ +add_filter('custom_menu_order', function () { + return true; +}); +add_filter('menu_order', 'my_new_admin_menu_order'); +/** + * Filters WordPress' default menu order + */ +function my_new_admin_menu_order($menu_order) +{ + // define your new desired menu positions here + // for example, move 'upload.php' to position #9 and built-in pages to position #1 + $new_positions = array( + 'upload.php' => 9, + // 'edit.php?post_type=page' => 1, + 'edit.php?post_type=conseils' => 1, + 'edit.php?post_type=questions' => 2, + 'edit.php?post_type=brochures' => 3, + 'edit.php?post_type=fiches-infos' => 4, + 'edit.php?post_type=vocabulaire' => 5, + ); + // helper function to move an element inside an array + function move_element(&$array, $a, $b) + { + $out = array_splice($array, $a, 1); + array_splice($array, $b, 0, $out); + } + // traverse through the new positions and move + // the items if found in the original menu_positions + foreach ($new_positions as $value => $new_index) { + if ($current_index = array_search($value, $menu_order)) { + move_element($menu_order, $current_index, $new_index); + } + } + return $menu_order; +}; diff --git a/includes/ajax.php b/includes/ajax.php new file mode 100644 index 0000000..d2a2000 --- /dev/null +++ b/includes/ajax.php @@ -0,0 +1,125 @@ + admin_url('admin-ajax.php'), + 'ajax_nonce' => wp_create_nonce('load_more_post_nonce') + ]); + } +} +add_action('wp_enqueue_scripts', 'add_ajax_scripts'); + + +/* --------------------------- + LOAD MORE BROCHURES + ---------------------------*/ +add_action('wp_ajax_get_more_brochures', 'load_more_brochures'); +add_action('wp_ajax_nopriv_get_more_brochures', 'load_more_brochures'); + +function load_more_brochures() +{ + + $offset = $_POST['ajax_data']['offset']; + + + + // $data['user1'] = 'server response user1'; + // $data['user2'] = 'server response user2'; + + // wp_send_json_success($data); + + $args = array( + 'post_type' => 'brochures', + 'posts_per_page' => 1, + 'post_status' => 'publish', + 'offset' => $offset, + 'order' => 'DESC', + 'orderby' => 'date', + 'meta_key' => 'brochure_pdf', + 'meta_value' => '', + 'meta_compare' => '!=' + ); + + $ajax_query = new WP_Query($args); + + // $isQueryEmpty = $ajax_query->have_posts() ? false : true; + $isQueryEmpty = $offset + 1 >= $ajax_query->max_num_pages ? true : false; + write_log($isQueryEmpty); + + // BREAK IF QUERY IS EMPTY + if ($ajax_query->have_posts() == false) { + wp_send_json(array('data' => '', 'isQueryEmpty' => $isQueryEmpty)); + die(); + } + + ob_start(); + if ($ajax_query->have_posts()) : while ($ajax_query->have_posts()) : $ajax_query->the_post(); + get_template_part('template-components/archives/brochure-grid-row', null, array('ID' => get_the_ID())); + endwhile; + endif; + + // ob_end_flush(); + $response = ob_get_clean(); + wp_send_json(array('data' => $response, 'isQueryEmpty' => $isQueryEmpty)); + + die(); +} + +/* --------------------------- + LOAD MORE FICHES INFOS + ---------------------------*/ + +add_action('wp_ajax_get_more_fiches_infos', 'load_more_fiches_infos'); +add_action('wp_ajax_nopriv_get_more_fiches_infos', 'load_more_fiches_infos'); + +function load_more_fiches_infos() +{ + + $offset = $_POST['ajax_data']['offset']; + + $args = array( + 'post_type' => 'fiches-infos', + 'posts_per_page' => 1, + 'post_status' => 'publish', + 'offset' => $offset, + 'order' => 'DESC', + 'orderby' => 'date', + 'meta_key' => 'brochure_pdf', + 'meta_value' => '', + 'meta_compare' => '!=' + ); + + $ajax_query = new WP_Query($args); + + // $isQueryEmpty = $ajax_query->have_posts() ? false : true; + $isQueryEmpty = $offset + 1 >= $ajax_query->max_num_pages ? true : false; + write_log($isQueryEmpty); + + // BREAK IF QUERY IS EMPTY + if ($ajax_query->have_posts() == false) { + wp_send_json(array('data' => '', 'isQueryEmpty' => $isQueryEmpty)); + die(); + } + + ob_start(); + if ($ajax_query->have_posts()) : while ($ajax_query->have_posts()) : $ajax_query->the_post(); + get_template_part('template-components/archives/brochure-grid-row', null, array('ID' => get_the_ID())); + endwhile; + endif; + + // ob_end_flush(); + $response = ob_get_clean(); + wp_send_json(array('data' => $response, 'isQueryEmpty' => $isQueryEmpty)); + + die(); +} diff --git a/includes/blocks.php b/includes/blocks.php index ec3a2dd..841cf0a 100755 --- a/includes/blocks.php +++ b/includes/blocks.php @@ -64,12 +64,10 @@ add_action('enqueue_block_editor_assets', 'my_register_blocks_scripts'); - - // ##### Blocks style 🡒 Re-enqueue d'un style dans l'éditeur // function block_newsfeed_add_editor_styles() { // add_editor_style( get_stylesheet_directory_uri() . '/template-parts/blocks/editor.css' ); // } -// add_action( 'admin_init', 'block_newsfeed_add_editor_styles' ); \ No newline at end of file +// add_action( 'admin_init', 'block_newsfeed_add_editor_styles' ); diff --git a/includes/init.php b/includes/init.php index c13b8f5..ba0138c 100644 --- a/includes/init.php +++ b/includes/init.php @@ -57,7 +57,7 @@ function tailpress_enqueue_scripts() wp_enqueue_script('gsap', get_template_directory_uri() . '/assets/gsap/gsap.min.js', array(), $theme->get('Version')); wp_enqueue_style('swipercss', get_template_directory_uri() . '/assets/swiper/swiper-bundle.min.css', array(), $theme->get('Version')); wp_enqueue_style('tailpress', tailpress_asset('css/app.css'), array(), $theme->get('Version')); - wp_enqueue_script('tailpress', tailpress_asset('js/app.js'), array('gsap'), $theme->get('Version')); + wp_enqueue_script('tailpress', tailpress_asset('js/app.js'), array('gsap', 'jquery'), $theme->get('Version')); // wp_register_script('showthematiquejs', get_template_directory_uri() . '/template-blocks/home/show-thematiques/show-thematiques.js', array('swiperjs', 'swipercss'), $theme->get('Version')); diff --git a/includes/post_types.php b/includes/post_types.php index 7596846..f1bebb8 100644 --- a/includes/post_types.php +++ b/includes/post_types.php @@ -100,6 +100,23 @@ function create_posttype() 'supports' => array('title', 'custom-fields', 'editor', 'excerpt'), ) ); + register_post_type( + 'fiches-infos', + array( + 'labels' => array( + 'name' => __('Fiches Infos', 'homegrade-theme__texte-backoffice'), + 'singular_name' => __('Fiches Info', 'homegrade-theme__texte-backoffice') + ), + 'public' => true, + 'has_archive' => false, + // 'rewrite' => array('slug' => 'questions'), + // 'rewrite' => array('slug' => 'questions/%thematiques%'), + 'show_in_rest' => true, + 'menu_icon' => 'dashicons-info-outline', + 'menu_position' => 2.1, + 'supports' => array('title', 'custom-fields', 'excerpt'), + ) + ); register_post_type( 'vocabulaire', array( @@ -111,7 +128,7 @@ function create_posttype() 'has_archive' => true, 'rewrite' => array('slug' => 'fiche'), 'show_in_rest' => true, - 'menu_icon' => 'dashicons-info-outline', + 'menu_icon' => 'dashicons-testimonial', 'menu_position' => 5.1, 'supports' => array('title', 'custom-fields'), ) @@ -119,46 +136,3 @@ function create_posttype() } add_action('init', 'create_posttype'); - - - -/* ---------------------------------------------------------------------- - POST TYPE ORDER - ------------------------------------------------------------------------*/ -/** - * Activates the 'menu_order' filter and then hooks into 'menu_order' - */ -add_filter('custom_menu_order', function () { - return true; -}); -add_filter('menu_order', 'my_new_admin_menu_order'); -/** - * Filters WordPress' default menu order - */ -function my_new_admin_menu_order($menu_order) -{ - // define your new desired menu positions here - // for example, move 'upload.php' to position #9 and built-in pages to position #1 - $new_positions = array( - 'upload.php' => 9, - // 'edit.php?post_type=page' => 1, - 'edit.php?post_type=conseils' => 1, - 'edit.php?post_type=questions' => 2, - 'edit.php?post_type=brochures' => 3, - 'edit.php?post_type=vocabulaire' => 4, - ); - // helper function to move an element inside an array - function move_element(&$array, $a, $b) - { - $out = array_splice($array, $a, 1); - array_splice($array, $b, 0, $out); - } - // traverse through the new positions and move - // the items if found in the original menu_positions - foreach ($new_positions as $value => $new_index) { - if ($current_index = array_search($value, $menu_order)) { - move_element($menu_order, $current_index, $new_index); - } - } - return $menu_order; -}; diff --git a/js/app.js b/js/app.js index 7173ad9..f94a067 100644 --- a/js/app.js +++ b/js/app.js @@ -202,8 +202,32 @@ }); } + // resources/js/single-conseil.js + function singleConseil() { + let chapterIndex = document.querySelector(".chapter_index"); + let questionBlocks = document.querySelectorAll(".questions-container-block"); + function handleLinksBehavior() { + let chapterLinks = document.querySelectorAll(".chapter_index__link"); + chapterLinks.forEach((link) => { + link.addEventListener("click", (e) => { + e.preventDefault(); + let target = e.target.getAttribute("href"); + let targetBlock = document.querySelector(target); + console.log(targetBlock); + targetBlock.scrollIntoView({ + behavior: "smooth" + }); + }); + }); + } + function handleChapterIndicatorPosition() { + } + handleLinksBehavior(); + } + // resources/js/app.js window.addEventListener("load", function() { menuInit(); + singleConseil(); }); })(); diff --git a/resources/css/admin-style.css b/resources/css/admin-style.css index 7069bf5..49ec54b 100644 --- a/resources/css/admin-style.css +++ b/resources/css/admin-style.css @@ -19,68 +19,3 @@ .block-editor-block-list__block { background-color: yellow !imporatant; */ /* } */ - -body.acoustique-coproprietes { - h2, - h3 { - @apply text-acoustique-coproprietes; - } - ul li::marker { - @apply text-acoustique-coproprietes; - } - .homegrade-blocks-highlight { - @apply bg-acoustique-coproprietes-light; - } -} -body.energies-urbanisme { - h2, - h3 { - @apply text-energies-urbanisme; - } - ul li::marker { - @apply text-energies-urbanisme; - } - .homegrade-blocks-highlight { - @apply bg-energies-urbanisme-light; - } -} -body.isolation-quotidien { - h2, - h3 { - @apply text-isolation-quotidien; - } - ul li::before { - @apply bg-isolation-quotidien; - } - ul li::marker { - @apply text-isolation-quotidien; - } - .homegrade-blocks-highlight { - @apply bg-isolation-quotidien-light; - } -} -body.patrimoine-renovation { - h1, - h2, - h3 { - @apply text-patrimoine-renovation; - } - ul li::marker { - @apply text-patrimoine-renovation; - } - .homegrade-blocks-highlight { - @apply bg-patrimoine-renovation-light; - } -} -body.location { - h2, - h3 { - @apply text-location; - } - ul li::marker { - @apply text-location; - } - .homegrade-blocks-highlight { - @apply bg-location-light; - } -} diff --git a/resources/css/app.css b/resources/css/app.css index 5147f49..12bcd99 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -23,15 +23,15 @@ @import './components/archive-page-header.css'; @import './components/brochures-grid.css'; -@import '../../template-components/card-news.css'; -@import '../../template-components/card-frequent_question.css'; -@import '../../template-components/card-thematique.css'; +@import '../../template-components/cards/card-news.css'; +@import '../../template-components/cards/card-frequent_question.css'; +@import '../../template-components/cards/card-thematique.css'; +@import '../../template-components/post-conseils/chapter-header.css'; /* ########### LAYOUT ############ */ @import './layout/header.css'; @import './layout/footer.css'; @import './layout/section.css'; -@import './layout/gutenberg.css'; @import './layout/menu-renovateur.css'; @import './layout/menu-homegrade.css'; @@ -46,7 +46,7 @@ @import '../../template-blocks/home/questions-frequentes/questions-frequentes.css'; /* ########### ADD STYLE LAYER TO CONTENT BLOCKS (FROM PLUGIN) ############ */ -@import './blocks/chapter-header-block.css'; +/* @import './blocks/chapter-header-block.css'; */ @import './blocks/questions-container-block.css'; @import './blocks/points-cles.css'; @import './blocks/highlight.css'; @@ -56,3 +56,8 @@ @import './pages/template-archive-brochures.css'; @import './pages/template-archive-conseils.css'; @import './pages/template-archive-questions.css'; +@import './pages/single-conseils.css'; + +/* ###### EDITOR ##### */ +@import './editor-content/color-taxonomy-scheme.css'; +@import './editor-content/gutenberg.css'; diff --git a/resources/css/blocks/chapter-header-block.css b/resources/css/blocks/chapter-header-block.css index 187b565..a784335 100644 --- a/resources/css/blocks/chapter-header-block.css +++ b/resources/css/blocks/chapter-header-block.css @@ -1,4 +1,4 @@ -.chapter-header-block { +.homegrade-blocks-chapter-header-block { @apply p-8 md:px-16; &__page-thematic-title { @apply text-xl uppercase font-bold tracking-wider pb-4; diff --git a/resources/css/components/section-titling.css b/resources/css/components/section-titling.css index 37adcb7..06cbac7 100644 --- a/resources/css/components/section-titling.css +++ b/resources/css/components/section-titling.css @@ -1,8 +1,5 @@ .section_titling { @apply text-center pb-8; - &--left { - @apply text-left; - } &__title { @apply text-secondary @@ -12,9 +9,7 @@ pb-2 tracking-widest; } - &.section_titling--left { - @apply bg-yellow-400; - } + &__subtitle { @apply text-black font-bold @@ -26,6 +21,13 @@ &__description { @apply text-lg pt-4 max-w-3xl mx-auto; } + + &--left { + @apply text-left; + .section_titling__subtitle { + @apply ml-0; + } + } } .content-intertitle { diff --git a/resources/css/editor-content/color-taxonomy-scheme.css b/resources/css/editor-content/color-taxonomy-scheme.css new file mode 100644 index 0000000..d3a4121 --- /dev/null +++ b/resources/css/editor-content/color-taxonomy-scheme.css @@ -0,0 +1,87 @@ +.entry-content--acoustique-coproprietes, +body.acoustique-coproprietes, +.post-conseil-page--acoustique-coproprietes { + h2, + h3, + ul li::marker { + @apply text-acoustique-coproprietes; + } + + .homegrade-blocks-highlight, + .homegrade-blocks-chapter-header-block, + .post-conseils-chapter-header { + @apply bg-acoustique-coproprietes-light; + } + + .chapter_index__position-indicator { + @apply bg-acoustique-coproprietes; + } +} +.entry-content--energies-urbanisme, +body.energies-urbanisme, +.post-conseil-page--energies-urbanisme { + h2, + h3, + ul li::marker { + @apply text-energies-urbanisme; + } + .homegrade-blocks-highlight, + .homegrade-blocks-chapter-header-block, + .post-conseils-chapter-header { + @apply bg-energies-urbanisme-light; + } + .chapter_index__position-indicator { + @apply bg-energies-urbanisme; + } +} +.entry-content--isolation-quotidien, +body.isolation-quotidien, +.post-conseil-page--isolation-quotidien { + h2, + h3, + ul li::marker { + @apply text-isolation-quotidien; + } + .homegrade-blocks-highlight, + .homegrade-blocks-chapter-header-block, + .post-conseils-chapter-header { + @apply bg-isolation-quotidien-light; + } + .chapter_index__position-indicator { + @apply bg-isolation-quotidien; + } +} +.entry-content--patrimoine-renovation, +body.patrimoine-renovation, +.post-conseil-page--patrimoine-renovation { + h2, + h3, + ul li::marker { + @apply text-patrimoine-renovation; + } + .homegrade-blocks-highlight, + .homegrade-blocks-chapter-header-block, + .post-conseils-chapter-header { + @apply bg-patrimoine-renovation-light; + } + .chapter_index__position-indicator { + @apply bg-patrimoine-renovation; + } +} +.entry-content--location, +body.location, +.post-conseil-page--location { + h2, + h3, + ul li::marker { + @apply text-location; + } + .homegrade-blocks-highlight, + .homegrade-blocks-chapter-header-block, + .post-conseils-chapter-header { + @apply bg-location-light; + } + .chapter_index__position-indicator { + @apply bg-location; + } +} diff --git a/resources/css/editor-content/gutenberg.css b/resources/css/editor-content/gutenberg.css new file mode 100644 index 0000000..002717c --- /dev/null +++ b/resources/css/editor-content/gutenberg.css @@ -0,0 +1,49 @@ +article > *:not(.entry-content, .chapter-header-block), +.entry-content > * { + @apply mx-auto max-w-content; +} + +.entry-content { + h1 { + @apply text-2xl; + } + + h2 { + @apply text-xl; + } + + h3 { + @apply font-bold text-2xl; + } + + p, + ul, + ol { + a { + @apply text-primary font-bold underline underline-offset-4; + /* &:after { + @apply inline-block bg-red-500 h-3 w-3 ml-2; + content: ''; + background-image: url('/wp-content/themes/homegrade/dist/images/arrow.svg'); + } */ + + &:hover { + @apply no-underline; + } + } + + @apply mb-8; + } + + ul:not(.block-editor-block-variation-picker__variations) { + li { + @apply list-disc list-inside; + } + } + + ol { + li { + @apply list-decimal list-inside; + } + } +} diff --git a/resources/css/layout/gutenberg.css b/resources/css/layout/gutenberg.css deleted file mode 100644 index f4cc902..0000000 --- a/resources/css/layout/gutenberg.css +++ /dev/null @@ -1,110 +0,0 @@ -article > *:not(.entry-content, .chapter-header-block), -.entry-content > * { - @apply mx-auto max-w-content; -} - -.entry-content { - &--acoustique-coproprietes { - h2, - h3 { - @apply text-acoustique-coproprietes; - } - ul li::marker { - @apply text-acoustique-coproprietes; - } - .homegrade-blocks-highlight { - @apply bg-acoustique-coproprietes-light; - } - } - &--energies-urbanisme { - h2, - h3 { - @apply text-energies-urbanisme; - } - ul li::marker { - @apply text-energies-urbanisme; - } - .homegrade-blocks-highlight { - @apply bg-energies-urbanisme-light; - } - } - &--isolation-quotidien { - h2, - h3 { - @apply text-isolation-quotidien; - } - ul li::marker { - @apply text-isolation-quotidien; - } - .homegrade-blocks-highlight { - @apply bg-isolation-quotidien-light; - } - } - &--patrimoine-renovation { - h1, - h2, - h3 { - @apply text-patrimoine-renovation; - } - ul li::marker { - @apply text-patrimoine-renovation; - } - .homegrade-blocks-highlight { - @apply bg-patrimoine-renovation-light; - } - } - &--location { - h2, - h3 { - @apply text-location; - } - ul li::marker { - @apply text-location; - } - .homegrade-blocks-highlight { - @apply bg-location-light; - } - } - h1 { - @apply text-2xl; - } - - h2 { - @apply text-xl; - } - - h3 { - @apply font-bold text-2xl; - } - - p, - ul, - ol { - a { - @apply text-primary font-bold underline underline-offset-4; - /* &:after { - @apply inline-block bg-red-500 h-3 w-3 ml-2; - content: ''; - background-image: url('/wp-content/themes/homegrade/dist/images/arrow.svg'); - } */ - - &:hover { - @apply no-underline; - } - } - - @apply mb-8; - } - - ul:not(.block-editor-block-variation-picker__variations) { - li { - @apply list-disc list-inside; - } - } - - ol { - li { - @apply list-decimal list-inside; - } - } -} diff --git a/resources/css/pages/single-conseils.css b/resources/css/pages/single-conseils.css new file mode 100644 index 0000000..d5a5360 --- /dev/null +++ b/resources/css/pages/single-conseils.css @@ -0,0 +1,31 @@ +.post-conseil-page-container { + @apply px-8; +} + +.conseils_wrapper { + @apply flex gap-x-8 max-w-screen-2xl mx-auto; + + .chapter_index { + @apply bg-gray max-w-lg + p-12 + h-fit + sticky + left-0 + top-4 + rounded-2xl; + &__title { + @apply font-bold text-xl mb-3; + } + &__list { + @apply relative; + } + &__position-indicator { + @apply h-8 absolute top-0 -left-4 rounded-2xl; + width: 3px; + } + + a { + @apply block; + } + } +} diff --git a/resources/js/ajax.js b/resources/js/ajax.js new file mode 100644 index 0000000..ea8c83e --- /dev/null +++ b/resources/js/ajax.js @@ -0,0 +1,40 @@ +window.addEventListener('DOMContentLoaded', (event) => { + console.log(ajaxSiteConfig); + const button = document.getElementById('load-more-brochures'); + button.addEventListener('click', ajaxSubmit); + let offset = 1; + + function ajaxSubmit() { + // alert('ajaxSubmit'); + // var form = jQuery('#form'); + // var data = form.serialize(); + const ajaxUrl = ajaxSiteConfig?.ajaxUrl ?? ''; + const ajax_nonce = ajaxSiteConfig?.ajax_nonce ?? ''; + let ajaxPageData = { + offset: offset, + }; + jQuery.ajax({ + type: 'POST', + url: ajaxUrl, + + data: { + action: 'get_more_brochures', // the action to fire in the server + ajax_data: ajaxPageData, // any JS object + }, + complete: function (response) { + if (response.responseJSON.data) { + console.log(response.responseJSON); + offset += 1; + const container = document.querySelector('.brochures-grid'); // Replace this with the actual container element + container.innerHTML += response.responseJSON.data; // Append the new content + if (response.responseJSON.isQueryEmpty) { + button.style.display = 'none'; + } + } + }, + }); + + // return false; + } +}); +// url: ajaxurl, diff --git a/resources/js/app.js b/resources/js/app.js index 47ede7c..84b922a 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,5 +1,7 @@ import menuInit from './header'; +import singleConseil from './single-conseil'; window.addEventListener('load', function () { menuInit(); + singleConseil(); }); diff --git a/resources/js/single-conseil.js b/resources/js/single-conseil.js new file mode 100644 index 0000000..cd9276a --- /dev/null +++ b/resources/js/single-conseil.js @@ -0,0 +1,32 @@ +export default function singleConseil() { + let chapterIndex = document.querySelector('.chapter_index'); + let questionBlocks = document.querySelectorAll('.questions-container-block'); + + function handleLinksBehavior() { + let chapterLinks = document.querySelectorAll('.chapter_index__link'); + + chapterLinks.forEach((link) => { + link.addEventListener('click', (e) => { + e.preventDefault(); + let target = e.target.getAttribute('href'); + let targetBlock = document.querySelector(target); + console.log(targetBlock); + targetBlock.scrollIntoView({ + behavior: 'smooth', + }); + }); + }); + } + + function handleChapterIndicatorPosition() { + let chapterIndicator = document.querySelector('.chapter_index__position-indicator'); + + + } + + } + handleLinksBehavior(); + // console.log(chapterIndex); + // console.log(questionBlocks); + // console.log(chapterLinks); +} diff --git a/single-conseils.php b/single-conseils.php new file mode 100644 index 0000000..ac144ec --- /dev/null +++ b/single-conseils.php @@ -0,0 +1,61 @@ + $block) { + if ($block['blockName'] == 'homegrade-content-blocks/questions-container') { + array_push($chapterIndex, $block['attrs']['relatedPostId']); + } + } + return $chapterIndex; +} +?> + + + + + slug); + ?> +
""> + post_content); + $chapterIndex = build_chapter_index($blocks); + ?> + +
+ + + + + +
"> + +
+
+
+ + + + + + + + + - 'activite', diff --git a/template-blocks/home/questions-frequentes/questions-frequentes.php b/template-blocks/home/questions-frequentes/questions-frequentes.php index f4b37f4..a7a7e3c 100644 --- a/template-blocks/home/questions-frequentes/questions-frequentes.php +++ b/template-blocks/home/questions-frequentes/questions-frequentes.php @@ -28,7 +28,7 @@ $block_titling = get_field('block_titling_description_datas'); $manual_data = get_field($thematique->slug . '_manual_data'); $post_datas = $manual_data ? $manual_data : get_automatic_post($thematique->slug); get_template_part( - 'template-components/card-frequent-question', + 'template-components/cards/card-frequent-question', null, array( 'thematique' => $thematique_datas, diff --git a/template-blocks/home/show-thematiques/show-thematiques.php b/template-blocks/home/show-thematiques/show-thematiques.php index 05b9f79..1c3afde 100755 --- a/template-blocks/home/show-thematiques/show-thematiques.php +++ b/template-blocks/home/show-thematiques/show-thematiques.php @@ -39,7 +39,7 @@ $terms = get_terms(array(
$term, diff --git a/template-components/archives/brochure-grid-row.php b/template-components/archives/brochure-grid-row.php new file mode 100644 index 0000000..20f0929 --- /dev/null +++ b/template-components/archives/brochure-grid-row.php @@ -0,0 +1,25 @@ + + + +
  • + + + +

    +

    name ?>

    + +

    + +
    + +
    +
  • \ No newline at end of file diff --git a/template-components/card-frequent-question.php b/template-components/cards/card-frequent-question.php similarity index 100% rename from template-components/card-frequent-question.php rename to template-components/cards/card-frequent-question.php diff --git a/template-components/card-frequent_question.css b/template-components/cards/card-frequent_question.css similarity index 100% rename from template-components/card-frequent_question.css rename to template-components/cards/card-frequent_question.css diff --git a/template-components/card-news.css b/template-components/cards/card-news.css similarity index 100% rename from template-components/card-news.css rename to template-components/cards/card-news.css diff --git a/template-components/card-news.php b/template-components/cards/card-news.php similarity index 100% rename from template-components/card-news.php rename to template-components/cards/card-news.php diff --git a/template-components/card-thematique.css b/template-components/cards/card-thematique.css similarity index 100% rename from template-components/card-thematique.css rename to template-components/cards/card-thematique.css diff --git a/template-components/card-thematique.php b/template-components/cards/card-thematique.php similarity index 100% rename from template-components/card-thematique.php rename to template-components/cards/card-thematique.php diff --git a/template-components/post-conseils/chapter-header.css b/template-components/post-conseils/chapter-header.css new file mode 100644 index 0000000..7ed9641 --- /dev/null +++ b/template-components/post-conseils/chapter-header.css @@ -0,0 +1,27 @@ +.post-conseils-chapter-header { + @apply p-8 md:px-16 mt-8 max-w-screen-2xl + flex + content-between + items-center mx-auto + rounded-2xl + items-center; + + margin-bottom: 20px; + + &__page-thematic-cover { + max-width: 400px; + } + &__page-thematic-title { + @apply text-xl uppercase font-bold tracking-wider pb-4; + } + &__page-title { + @apply text-4xl font-bold; + } + &__infos { + @apply max-w-2xl; + + .cta { + @apply my-8; + } + } +} diff --git a/template-components/post-conseils/chapter-header.php b/template-components/post-conseils/chapter-header.php new file mode 100644 index 0000000..bf66a41 --- /dev/null +++ b/template-components/post-conseils/chapter-header.php @@ -0,0 +1,53 @@ +parent ? get_term($thematique->parent, 'thematiques') : $thematique; +$thematique_generale_id_fr = apply_filters('wpml_object_id', $thematique_generale->term_id, 'thematiques', TRUE, 'fr'); + + +// Récupère la source de l'image par rapport à l'ID FR pour s'assurer de bien synchroniser les images dans les deux langues +$thematique_picture = get_field('taxonomy_pictures', "thematiques_" . $thematique_generale_id_fr)['illustration_s'] ?? null; +$lastUpdate = get_the_modified_date('', get_the_ID()); + +$args = array( + // 'fields' => 'ids', + 'post_type' => 'brochures', + 'posts_per_page' => 1, + 'tax_query' => array( + array( + 'taxonomy' => 'thematiques', + 'field' => 'term_id', + 'terms' => $thematique->term_id + ) + ) +); +$relatedBrochuresPosts = get_posts($args); +$relatedBrochure = get_field('brochure_pdf', $relatedBrochuresPosts[0]->ID) ?? null; + + +?> + + +
    +
    + parent == 0) : ?> + +

    slug) ?>">

    + +

    slug) ?>">name ?>

    + + + +

    + + + Télécharger la brochure post_title ?> + + + + + + + +
    + +
    \ No newline at end of file diff --git a/template-components/salut.php b/template-components/salut.php new file mode 100644 index 0000000..6b4d59f --- /dev/null +++ b/template-components/salut.php @@ -0,0 +1,4 @@ + +

    Salut

    \ No newline at end of file diff --git a/template-conseils.php b/template-conseils.php index 36caff1..562bd99 100644 --- a/template-conseils.php +++ b/template-conseils.php @@ -86,7 +86,15 @@ $thematiquesTerms = get_terms(array(
    - 'brochures', - 'posts_per_page' => -1, + 'posts_per_page' => 1, 'post_status' => 'publish', - 'orderby' => 'date', 'order' => 'DESC', + 'orderby' => 'date', + 'meta_key' => 'brochure_pdf', + 'meta_value' => '', + 'meta_compare' => '!=', + // ICI METAQUERY FOR LE PDF ); $brochures = new WP_Query($args); - - + $current_page_id = get_queried_object_id(); + $highlightedBrochure = get_field('highlighted_brochure', $current_page_id) ?? null; + $highlightedBrochurePdf = get_field('highlighted_brochure', $current_page_id) ?? null; + $highlightedBrochureComment = get_field('highlighted_brochure_comment', $current_page_id) ?? null; ?> + +
    +

    +

    post_title ?>

    + +

    + +
    + '; + print_r($highlightedBrochure); + echo ''; + ?> + + + + + + + + +
    +
    +

    +

    Curabitur eleifend neque eu erat lacinia tincidunt

    +
    + + 'fiches-infos', + 'posts_per_page' => 1, + 'post_status' => 'publish', + 'order' => 'DESC', + 'orderby' => 'date', + 'meta_key' => 'brochure_pdf', + 'meta_value' => '', + 'meta_compare' => '!=', + // ICI METAQUERY FOR LE PDF + ); + $brochures = new WP_Query($args); + + + ?> +
      + have_posts()) : while ($brochures->have_posts()) : $brochures->the_post(); ?> + + +
    • + + + +

      +

      name ?>

      + +

      + + +
      + +
      +
    • + + + + + +
    +