From eb9cf5e52ebf469fa22a059d76c303cde7a1d8de Mon Sep 17 00:00:00 2001 From: Antoine M Date: Thu, 3 Aug 2023 10:31:09 +0200 Subject: [PATCH] refining anysurfer --- css/app.css | 145 ++++++++++++++++-- css/editor-style.css | 9 +- header.php | 3 +- includes/blocks.php | 14 +- includes/init.php | 2 +- includes/post-brochures.php | 2 +- includes/post_types.php | 4 + includes/shortcuts/shortcuts.php | 3 + includes/taxonomy.php | 21 ++- includes/utilities.php | 8 + js/app.js | 2 + resources/css/app.css | 5 + resources/css/blocks/chapter-header-block.css | 16 ++ resources/css/blocks/points-cles.css | 14 ++ .../css/blocks/questions-container-block.css | 5 + resources/css/editor-style.css | 28 ++-- resources/css/layout/footer.css | 3 + resources/css/layout/gutenberg.css | 54 ++++++- resources/css/layout/menu-homegrade.css | 6 - resources/js/header.js | 1 + single.php | 37 ++--- taxonomy-thematiques.php | 49 ++++-- .../show-thematiques/show-thematiques.php | 2 - template-components/card-thematique.php | 4 +- .../header/menu-renovateur.php | 5 +- template-components/header/search-module.php | 2 +- 26 files changed, 362 insertions(+), 82 deletions(-) create mode 100644 resources/css/blocks/chapter-header-block.css create mode 100644 resources/css/blocks/points-cles.css create mode 100644 resources/css/blocks/questions-container-block.css diff --git a/css/app.css b/css/app.css index 185f360..bf3044c 100644 --- a/css/app.css +++ b/css/app.css @@ -1976,6 +1976,10 @@ header#main-header { } } +.site-footer__partenaires a img { + display: inline-block; +} + .site-footer__metiers-patrimoine { grid-column: span 4 / span 4; } @@ -1986,7 +1990,7 @@ header#main-header { } } -article > *:not(.entry-content), +article > *:not(.entry-content, .chapter-header-block), .entry-content > * { margin-left: auto; margin-right: auto; @@ -2038,6 +2042,68 @@ article > *:not(.entry-content), list-style-type: decimal; } +.single-editor-content h3 { + font-size: 1.5rem; + line-height: 2rem; + font-weight: 700; +} + +.single-editor-content--acoustique-coproprietes h2, + .single-editor-content--acoustique-coproprietes h3 { + --tw-text-opacity: 1; + color: rgb(36 94 242 / var(--tw-text-opacity)); +} + +.single-editor-content--acoustique-coproprietes ul li::marker { + --tw-text-opacity: 1; + color: rgb(36 94 242 / var(--tw-text-opacity)); +} + +.single-editor-content--energies-urbanisme h2, + .single-editor-content--energies-urbanisme h3 { + --tw-text-opacity: 1; + color: rgb(2 126 80 / var(--tw-text-opacity)); +} + +.single-editor-content--energies-urbanisme ul li::marker { + --tw-text-opacity: 1; + color: rgb(2 126 80 / var(--tw-text-opacity)); +} + +.single-editor-content--isolation-quotidien h2, + .single-editor-content--isolation-quotidien h3 { + --tw-text-opacity: 1; + color: rgb(194 69 3 / var(--tw-text-opacity)); +} + +.single-editor-content--isolation-quotidien ul li::marker { + --tw-text-opacity: 1; + color: rgb(194 69 3 / var(--tw-text-opacity)); +} + +.single-editor-content--patrimoine-renovation h1, + .single-editor-content--patrimoine-renovation h2, + .single-editor-content--patrimoine-renovation h3 { + --tw-text-opacity: 1; + color: rgb(139 47 247 / var(--tw-text-opacity)); +} + +.single-editor-content--patrimoine-renovation ul li::marker { + --tw-text-opacity: 1; + color: rgb(139 47 247 / var(--tw-text-opacity)); +} + +.single-editor-content--location h2, + .single-editor-content--location h3 { + --tw-text-opacity: 1; + color: rgb(223 0 43 / var(--tw-text-opacity)); +} + +.single-editor-content--location ul li::marker { + --tw-text-opacity: 1; + color: rgb(223 0 43 / var(--tw-text-opacity)); +} + .menu-renovateur { position: relative; display: flex; @@ -2744,14 +2810,6 @@ article > *:not(.entry-content), color: rgb(223 30 30 / var(--tw-text-opacity)); } -.menu-homegrade--footer > li.menu-item { - order: 5; -} - -.menu-homegrade--footer > li.menu-item-has-children { - order: 1; -} - .menu-homegrade--footer > li.menu-item > a, .menu-homegrade--footer h6.page-group-title { margin-bottom: 0.5rem; @@ -3252,6 +3310,75 @@ article > *:not(.entry-content), } } +/* ########### 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; +} + +.questions-container-block h2 { + font-size: 2.25rem; + line-height: 2.5rem; + font-weight: 700; + --tw-text-opacity: 1; + color: rgb(0 0 0 / var(--tw-text-opacity)); +} + +.wp-block-homegrade-content-blocks-points-cles { + border-radius: 1.5rem; + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); + padding: 2rem; + --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.wp-block-homegrade-content-blocks-points-cles__titling { + margin-bottom: 1.5rem; +} + +.wp-block-homegrade-content-blocks-points-cles__titling .icon { + --tw-bg-opacity: 1; + background-color: rgb(47 1 84 / var(--tw-bg-opacity)); +} + +.wp-block-homegrade-content-blocks-points-cles h3 { + font-size: 1.5rem; + line-height: 2rem; + font-weight: 700; +} + /* ########### PAGE ############ */ .demo-components .title { diff --git a/css/editor-style.css b/css/editor-style.css index c0e40dc..b87791b 100644 --- a/css/editor-style.css +++ b/css/editor-style.css @@ -421,11 +421,11 @@ body { max-width: 1280px } -.wp-block[data-align="wide"] { +.wp-block[data-align='wide'] { max-width: 1280px } -.wp-block[data-align="full"] { +.wp-block[data-align='full'] { max-width: 100% } @@ -443,6 +443,11 @@ body { max-width: 782px } +.block-editor-default-block-appender .block-editor-inserter button { + --tw-bg-opacity: 1 !important; + background-color: rgb(223 30 30 / var(--tw-bg-opacity)) !important +} + .hover\:bg-primary:hover { --tw-bg-opacity: 1; background-color: rgb(47 1 84 / var(--tw-bg-opacity)) diff --git a/header.php b/header.php index 36a3f64..44edcf9 100644 --- a/header.php +++ b/header.php @@ -7,9 +7,10 @@ + - +> 'homegrade-blocks', - 'title' => 'Homegrade Generic Blocks ', - 'icon' => 'heart', - ], - ], + // [ + // [ + // 'slug' => 'homegrade-blocks', + // 'title' => 'Homegrade Generic Blocks ', + // 'icon' => 'heart', + // ], + // ], $categories, [ [ diff --git a/includes/init.php b/includes/init.php index 7301345..c13b8f5 100644 --- a/includes/init.php +++ b/includes/init.php @@ -29,7 +29,7 @@ function tailpress_setup() 'caption', ) ); - // add_theme_support('title-tag'); + add_theme_support('title-tag'); add_theme_support('custom-logo'); add_theme_support('post-thumbnails'); diff --git a/includes/post-brochures.php b/includes/post-brochures.php index 8020dae..9d48bec 100644 --- a/includes/post-brochures.php +++ b/includes/post-brochures.php @@ -8,7 +8,7 @@ function homegrade_brochure_post_title_updater($post_id) $brochureTaxonomy = get_the_terms($post_id, 'thematiques')[0]; - write_log($brochureTaxonomy); + // write_log($brochureTaxonomy); if (get_post_type() == 'brochures') { diff --git a/includes/post_types.php b/includes/post_types.php index 39df99f..21b14a0 100644 --- a/includes/post_types.php +++ b/includes/post_types.php @@ -51,6 +51,10 @@ function create_posttype() 'name' => __('Conseils', 'homegrade-theme__texte-backoffice'), 'singular_name' => __('Conseil', 'homegrade-theme__texte-backoffice') ), + 'template' => [ + array('homegrade-content-blocks/chapter-header'), + array('core/paragraph', ['placeholder' => 'Add truc Description…',]), + ], 'hierarchical' => true, 'public' => true, 'has_archive' => true, diff --git a/includes/shortcuts/shortcuts.php b/includes/shortcuts/shortcuts.php index 803524c..cf65538 100644 --- a/includes/shortcuts/shortcuts.php +++ b/includes/shortcuts/shortcuts.php @@ -11,6 +11,8 @@ define('WP_DEBUG_DISPLAY', false);

+ +

Alternative content when $var is falsy or null

@@ -37,6 +39,7 @@ get_template_part( QUERIES ------------------------------*/ + // ##### Query πŸ‘’ Get posts $args = array( diff --git a/includes/taxonomy.php b/includes/taxonomy.php index 5c2e1bb..cc0ee22 100644 --- a/includes/taxonomy.php +++ b/includes/taxonomy.php @@ -1,6 +1,8 @@ parent == 0) { + return $thematique; + } else { + return get_term($thematique->parent, 'thematiques'); + } +} // Get automatic post used in BLOCK QUESTIONS FREQUENTES diff --git a/js/app.js b/js/app.js index df0390c..7173ad9 100644 --- a/js/app.js +++ b/js/app.js @@ -2,6 +2,8 @@ // resources/js/header.js function menuInit() { const header = document.querySelector("#main-header"); + if (!header) + return; const searchModule = header.querySelector(".search-module"); const searchModuleToggle = header.querySelector("#search-module-toggle"); const mobileMenuToggle = header.querySelector("#mobile-menu-toggle"); diff --git a/resources/css/app.css b/resources/css/app.css index 7d3f894..dd76041 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -40,5 +40,10 @@ @import '../../template-blocks/home/demarches-administratives/demarches-administratives.css'; @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/questions-container-block.css'; +@import './blocks/points-cles.css'; + /* ########### PAGE ############ */ @import './pages/demo-components.css'; diff --git a/resources/css/blocks/chapter-header-block.css b/resources/css/blocks/chapter-header-block.css new file mode 100644 index 0000000..187b565 --- /dev/null +++ b/resources/css/blocks/chapter-header-block.css @@ -0,0 +1,16 @@ +.chapter-header-block { + @apply p-8 md:px-16; + &__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/resources/css/blocks/points-cles.css b/resources/css/blocks/points-cles.css new file mode 100644 index 0000000..3127467 --- /dev/null +++ b/resources/css/blocks/points-cles.css @@ -0,0 +1,14 @@ +.wp-block-homegrade-content-blocks-points-cles { + @apply p-8 shadow-lg bg-white rounded-3xl; + + &__titling { + @apply mb-6; + .icon { + @apply bg-primary; + } + } + + h3 { + @apply font-bold text-2xl; + } +} diff --git a/resources/css/blocks/questions-container-block.css b/resources/css/blocks/questions-container-block.css new file mode 100644 index 0000000..a6ebeb9 --- /dev/null +++ b/resources/css/blocks/questions-container-block.css @@ -0,0 +1,5 @@ +.questions-container-block { + h2 { + @apply font-bold text-black text-4xl; + } +} diff --git a/resources/css/editor-style.css b/resources/css/editor-style.css index 5844952..a6731b6 100644 --- a/resources/css/editor-style.css +++ b/resources/css/editor-style.css @@ -1,28 +1,34 @@ -@import "tailwindcss/components"; -@import "tailwindcss/utilities"; +@import 'tailwindcss/components'; +@import 'tailwindcss/utilities'; body { - @apply font-sans; + @apply font-sans; } .wp-block { - @apply max-w-screen-xl; + @apply max-w-screen-xl; } -.wp-block[data-align="wide"] { - @apply max-w-screen-xl; +.wp-block[data-align='wide'] { + @apply max-w-screen-xl; } -.wp-block[data-align="full"] { - @apply max-w-full; +.wp-block[data-align='full'] { + @apply max-w-full; } .wp-block.alignfull { - @apply max-w-full; + @apply max-w-full; } .acf-block-component { - /* @apply bg-red-500; */ + /* @apply bg-red-500; */ } .acf-block-fields { - @apply max-w-screen-md mx-auto; + @apply max-w-screen-md mx-auto; +} + +.block-editor-default-block-appender .block-editor-inserter { + button { + @apply !bg-secondary; + } } diff --git a/resources/css/layout/footer.css b/resources/css/layout/footer.css index 50c6a21..36c90d2 100644 --- a/resources/css/layout/footer.css +++ b/resources/css/layout/footer.css @@ -40,6 +40,9 @@ } &__partenaires { @apply flex flex-wrap col-span-4 md:col-span-2 justify-center items-center gap-12; + a img { + @apply inline-block; + } } &__metiers-patrimoine { diff --git a/resources/css/layout/gutenberg.css b/resources/css/layout/gutenberg.css index 7fbba36..1a86f3a 100644 --- a/resources/css/layout/gutenberg.css +++ b/resources/css/layout/gutenberg.css @@ -1,4 +1,4 @@ -article > *:not(.entry-content), +article > *:not(.entry-content, .chapter-header-block), .entry-content > * { @apply mx-auto max-w-content; } @@ -43,3 +43,55 @@ article > *:not(.entry-content), } } } + +.single-editor-content { + h3 { + @apply font-bold text-2xl; + } + &--acoustique-coproprietes { + h2, + h3 { + @apply text-acoustique-coproprietes; + } + ul li::marker { + @apply text-acoustique-coproprietes; + } + } + &--energies-urbanisme { + h2, + h3 { + @apply text-energies-urbanisme; + } + ul li::marker { + @apply text-energies-urbanisme; + } + } + &--isolation-quotidien { + h2, + h3 { + @apply text-isolation-quotidien; + } + ul li::marker { + @apply text-isolation-quotidien; + } + } + &--patrimoine-renovation { + h1, + h2, + h3 { + @apply text-patrimoine-renovation; + } + ul li::marker { + @apply text-patrimoine-renovation; + } + } + &--location { + h2, + h3 { + @apply text-location; + } + ul li::marker { + @apply text-location; + } + } +} diff --git a/resources/css/layout/menu-homegrade.css b/resources/css/layout/menu-homegrade.css index 2210a77..ea571d8 100644 --- a/resources/css/layout/menu-homegrade.css +++ b/resources/css/layout/menu-homegrade.css @@ -245,12 +245,6 @@ li.menu-item a { @apply hover:text-secondary; } - > li.menu-item { - order: 5; - } - > li.menu-item-has-children { - order: 1; - } > li.menu-item > a, h6.page-group-title { diff --git a/resources/js/header.js b/resources/js/header.js index ca85944..d9bf283 100644 --- a/resources/js/header.js +++ b/resources/js/header.js @@ -1,5 +1,6 @@ export default function menuInit() { const header = document.querySelector('#main-header'); + if (!header) return; // Search module const searchModule = header.querySelector('.search-module'); diff --git a/single.php b/single.php index 18c7c1b..b41217a 100644 --- a/single.php +++ b/single.php @@ -1,27 +1,22 @@ - - -
- - - + - - + + slug); + ?> +
"> + - -
+ -'; -print_r($term); -print_r(is_tax('thematiques', 'thematiques')); -echo ''; +// $term = get_queried_object(); +// $term_test = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); + +$current_general_thematique = get_queried_object()->parent ? get_term(get_queried_object()->parent, 'thematiques') : get_term(get_queried_object(), 'thematiques'); +$current_children_thematique = get_queried_object()->parent != 0 ? get_queried_object() : null; + + $args = array( 'posts_per_page' => 1, @@ -14,14 +16,26 @@ $args = array( 'slug' => 'locations', 'taxonomy' => 'thematiques', 'field' => 'slug', - 'terms' => $term->slug, - 'include_children' => false, + 'terms' => get_queried_object()->slug, + // 'include_children' => false, ) ) ); -$query_thematique_posts = new WP_Query($args); -$thematique_related_page = $query_thematique_posts->posts[0]; +$query_current_thematique_posts = new WP_Query($args); +$thematique_related_page = $query_current_thematique_posts->posts[0]; +echo '
';
+// print_r($term);
+// print_r($term_test);
+// print_r($query_current_thematique_posts->posts);
+// print_r($thematique_related_page);
+// print_r($current_children_thematique);
+// print_r($current_thematique);
+// print_r(is_tax('thematiques', 'thematiques'));
+echo '
'; + + +$test = get_term_by('id', 12, 'category'); if ($term->parent == 0) { @@ -42,7 +56,24 @@ if ($term->parent == 0) { // echo $the_query->posts[0]->post_content; ?> +
false, )); - ?> -
diff --git a/template-components/card-thematique.php b/template-components/card-thematique.php index 8e41594..34c24c1 100644 --- a/template-components/card-thematique.php +++ b/template-components/card-thematique.php @@ -13,8 +13,8 @@ $color = getThematiqueFamilySlug($thematique->slug);

description ?>

- En savoir plus - sur slug ?> + + slug ?>
diff --git a/template-components/header/menu-renovateur.php b/template-components/header/menu-renovateur.php index 3bfbebd..802a32d 100644 --- a/template-components/header/menu-renovateur.php +++ b/template-components/header/menu-renovateur.php @@ -17,7 +17,7 @@ $logoSRC = wp_get_attachment_image_src($logoID, 'full');