srtting up ajax, building chapter index for conseils, declaring post type fiches-infos

This commit is contained in:
Antoine M 2023-08-12 10:50:39 +02:00
parent 19027d2d4b
commit 4fcf41543a
38 changed files with 1127 additions and 532 deletions

View File

@ -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));
}
/* } */

View File

@ -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));

View File

@ -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');

View File

@ -7,7 +7,7 @@
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
@ -47,4 +47,12 @@
<?php do_action('tailpress_content_start'); ?>
<?php
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$thematiqueParent = getParentThematique($thematique);
$thematiqueColorSlug = getThematiqueFamilySlug($thematiqueParent->slug);
?>
<main id="content" class="site-content flex-grow">

View File

@ -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;
};

125
includes/ajax.php Normal file
View File

@ -0,0 +1,125 @@
<?php
/* ---------------------------
AJAX PUBLICATIONS
---------------------------*/
function add_ajax_scripts()
{
if (is_page_template('template-publications.php')) {
wp_enqueue_script('ajax-load-more', get_template_directory_uri() . '/resources/js/ajax.js', array('jquery'), '1.0', true);
// pass Ajax Url to script.js
// wp_localize_script('script', 'ajaxurl', admin_url('admin-ajax.php'));
wp_localize_script('ajax-load-more', 'ajaxSiteConfig', [
'ajaxUrl' => 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();
}

View File

@ -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' );
// add_action( 'admin_init', 'block_newsfeed_add_editor_styles' );

View File

@ -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'));

View File

@ -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;
};

View File

@ -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();
});
})();

View File

@ -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;
}
}

View File

@ -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';

View File

@ -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;

View File

@ -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 {

View File

@ -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;
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

40
resources/js/ajax.js Normal file
View File

@ -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,

View File

@ -1,5 +1,7 @@
import menuInit from './header';
import singleConseil from './single-conseil';
window.addEventListener('load', function () {
menuInit();
singleConseil();
});

View File

@ -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);
}

61
single-conseils.php Normal file
View File

@ -0,0 +1,61 @@
<?php
get_header();
function build_chapter_index($blocks)
{
$chapterIndex = [];
foreach ($blocks as $key => $block) {
if ($block['blockName'] == 'homegrade-content-blocks/questions-container') {
array_push($chapterIndex, $block['attrs']['relatedPostId']);
}
}
return $chapterIndex;
}
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$thematiqueParent = getParentThematique($thematique);
$thematiqueColorSlug = getThematiqueFamilySlug($thematiqueParent->slug);
?>
<div class="post-conseil-page-container <?php echo $thematiqueColorSlug ? "post-conseil-page--" . $thematiqueColorSlug : "" ?>"">
<?php
$blocks = parse_blocks($post->post_content);
$chapterIndex = build_chapter_index($blocks);
?>
<?php get_template_part('template-components/post-conseils/chapter-header'); ?>
<div class=" conseils_wrapper">
<aside class="chapter_index">
<div class="chapter_index__titling">
<div class="icon"></div>
<h2 class="chapter_index__title">Dans ce conseil</h2>
</div>
<ul class="chapter_index__list">
<div class="chapter_index__position-indicator"></div>
<?php foreach ($chapterIndex as $chapterRelatedPostID) : ?>
<?php $chapterTitle = get_the_title($chapterRelatedPostID); ?>
<li class="chapter_index__link"><a href="#questions-container-<?php echo $chapterRelatedPostID ?>"><?php echo $chapterTitle ?></a></li>
<?php endforeach; ?>
</ul>
</aside>
<article class="container my-8 mx-auto entry-content single-editor-content <?php echo $thematiqueColorSlug ? "entry-content--" . $thematiqueColorSlug : "" ?>">
<?php the_content() ?>
</article>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php
get_footer();

View File

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

View File

@ -22,7 +22,7 @@ $block_titling_datas = get_field('block_titling_datas');
$post_tags = get_the_tags($post['ID']);
get_template_part(
'template-components/card-news',
'template-components/cards/card-news',
null,
array(
'card_variant' => 'activite',

View File

@ -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,

View File

@ -39,7 +39,7 @@ $terms = get_terms(array(
<div class="swiper-slide">
<?php
get_template_part(
'template-components/card-thematique',
'template-components/cards/card-thematique',
null,
array(
'thematique' => $term,

View File

@ -0,0 +1,25 @@
<?php
$brochureCover = get_field('brochure_cover', $args['ID']);
$brochurePdf = get_field('brochure_pdf', $args['ID']);
$brochureEdition = get_field('brochure_edition', $args['ID']);
$thematique = get_the_terms($args['ID'], 'thematiques')[0];
$rootThematic = getParentThematique($thematique);
?>
<li class="brochures-grid__row">
<?php if ($brochureCover) : ?>
<img class="brochures-grid__cover" src="<?php echo $brochureCover['sizes']['medium'] ?>" />
<?php endif; ?>
<h2 class="brochures-grid__title"><?php echo $brochurePdf['title'] ?></h2>
<p class="brochures-grid__thematique"><?php echo $rootThematic->name ?></p>
<?php if ($brochureEdition) : ?>
<p class="brochures-grid__edition"><?php echo $brochureEdition ?></p>
<?php endif; ?>
<div class="brochures-grid__button">
<a href="<?php echo $brochurePdf['url'] ?>" class=" cta cta--secondary cta--button" href="#" target="_blank"><?php echo __("Consulter le pdf", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></a>
</div>
</li>

View File

@ -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;
}
}
}

View File

@ -0,0 +1,53 @@
<?php
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0] ?? null;
$thematique_generale = $thematique->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;
?>
<section class="post-conseils-chapter-header">
<div class="post-conseils-chapter-header__infos">
<?php if ($thematique->parent == 0) : ?>
<p class="post-conseils-chapter-header__page-thematic-title <?php echo "text-" . getThematiqueFamilySlug($thematique_generale->slug) ?>"><?php echo __("Les conseillers Homegrade vous guident", "homegrade-theme__bloks-texte-fonctionnel") ?></p>
<?php else : ?>
<p class="post-conseils-chapter-header__page-thematic-title <?php echo "text-" . getThematiqueFamilySlug($thematique_generale->slug) ?>"><?php echo $thematique_generale->name ?></p>
<?php endif; ?>
<h1 class="post-conseils-chapter-header__page-title"><?php echo get_the_title() ?></h1>
<?php if ($relatedBrochure) : ?>
<a class="cta cta--primary cta--button" href="<?php echo $relatedBrochure['url'] ?>" target="_blank">Télécharger la brochure <?php echo $relatedBrochures[0]->post_title ?></a>
<?php endif; ?>
<?php if ($lastUpdate) : ?>
<time>Dernière mise à jour : <?php echo $lastUpdate ?></time>
<?php endif; ?>
</div>
<img class="post-conseils-chapter-header__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt="">
</section>

View File

@ -0,0 +1,4 @@
<?php
?>
<h2>Salut</h2>

View File

@ -86,7 +86,15 @@ $thematiquesTerms = get_terms(array(
</div>
<!-- SERVICE -->
<div class="card-large-content__link">
<?php $services_page_ID = apply_filters('wpml_object_id', 52, 'page', TRUE); ?>
<?php
$services_page_ID_FR = get_field('services_page_ID', 'options');
// $services_page_ID = apply_filters('wpml_object_id', 52, 'page', TRUE);
$services_page_ID = apply_filters('wpml_object_id', $services_page_ID_FR, 'page', false);
echo '<pre>';
print_r("from options " . $services_page_ID_FR);
print_r("wpml interpretation " . $services_page_ID);
echo '</pre>';
?>
<img class="card-large-content__link__page_icon" src="<?php echo get_template_directory_uri() . '/resources/img/pictogrammes/pictogramme-services.svg' ?>" alt="">
<h3 class="card-large-content__link__title"><?php echo get_the_title($services_page_ID) ?></h3>
<p class="card-large-content__link__excerpt"><?php echo get_the_excerpt($services_page_ID) ?></p>

View File

@ -15,7 +15,6 @@ get_header();
<p class="archive-page-header__description"> <?php echo __("Découvrez toutes nos publications et outils en ligne", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?>
</p>
<?php get_search_form(); ?>
</section>
@ -25,22 +24,43 @@ get_header();
<p class="section_titling__subtitle">Curabitur eleifend neque eu erat lacinia tincidunt</p>
</div>
<?php
$args = array(
'post_type' => '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;
?>
<?php if ($highlightedBrochure) : ?>
<div class="highlighted_brochure">
<h3><?php echo __("Sélection de nos conseillers", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></h3>
<h3><?php echo $highlightedBrochure->post_title ?></h3>
<?php if ($highlightedBrochureComment) : ?>
<p><?php echo $highlightedBrochureComment ?></p>
<?php endif; ?>
</div>
<?php
echo '<pre>';
print_r($highlightedBrochure);
echo '</pre>';
?>
<?php endif; ?>
<ul class="brochures-grid">
<?php if ($brochures->have_posts()) : ?>
<?php while ($brochures->have_posts()) : $brochures->the_post(); ?>
<?php if ($brochures->have_posts()) : while ($brochures->have_posts()) : $brochures->the_post(); ?>
<?php
$brochureCover = get_field('brochure_cover', get_the_ID());
$brochurePdf = get_field('brochure_pdf', get_the_ID());
@ -49,26 +69,85 @@ get_header();
$rootThematic = getParentThematique($thematique);
?>
<?php if ($brochurePdf) : ?>
<li class="brochures-grid__row">
<?php if ($brochureCover) : ?>
<img class="brochures-grid__cover" src="<?php echo $brochureCover['sizes']['medium'] ?>" />
<?php endif; ?>
<h2 class="brochures-grid__title"><?php echo $brochurePdf['title'] ?></h2>
<p class="brochures-grid__thematique"><?php echo $rootThematic->name ?></p>
<?php if ($brochureEdition) : ?>
<p class="brochures-grid__edition"><?php echo $brochureEdition ?></p>
<?php endif; ?>
<div class="brochures-grid__button">
<a href="<?php echo $brochurePdf->url ?>" class=" cta cta--secondary cta--button" href="#" target="_blank"><?php echo __("Consulter le pdf", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></a>
</div>
</li>
<?php endif; ?>
<li class="brochures-grid__row">
<?php if ($brochureCover) : ?>
<img class="brochures-grid__cover" src="<?php echo $brochureCover['sizes']['medium'] ?>" />
<?php endif; ?>
<h2 class="brochures-grid__title"><?php echo $brochurePdf['title'] ?></h2>
<p class="brochures-grid__thematique"><?php echo $rootThematic->name ?></p>
<?php if ($brochureEdition) : ?>
<p class="brochures-grid__edition"><?php echo $brochureEdition ?></p>
<?php endif; ?>
<div class="brochures-grid__button">
<a href="<?php echo $brochurePdf['url'] ?>" class=" cta cta--secondary cta--button" href="#" target="_blank"><?php echo __("Consulter le pdf", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></a>
</div>
</li>
<?php endwhile ?>
<?php endif; ?>
</ul>
<button id="load-more-brochures" class="cta cta--button cta--shadowed" target="_blank"><?php echo __("Consulter toutes les brochures", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></button>
<?php wp_reset_postdata(); ?>
</section>
<section class="fiches-infos-archives">
<div class="section_titling section_titling--left">
<h2 class="section_titling__title"><?php echo __("Nos Brochures thématiques", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></h2>
<p class="section_titling__subtitle">Curabitur eleifend neque eu erat lacinia tincidunt</p>
</div>
<?php
$args = array(
'post_type' => '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);
?>
<ul class="brochures-grid">
<?php if ($brochures->have_posts()) : while ($brochures->have_posts()) : $brochures->the_post(); ?>
<?php
$brochureCover = get_field('brochure_cover', get_the_ID());
$brochurePdf = get_field('brochure_pdf', get_the_ID());
$brochureEdition = get_field('brochure_edition', get_the_ID());
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$rootThematic = getParentThematique($thematique);
?>
<li class="brochures-grid__row">
<?php if ($brochureCover) : ?>
<img class="brochures-grid__cover" src="<?php echo $brochureCover['sizes']['medium'] ?>" />
<?php endif; ?>
<h2 class="brochures-grid__title"><?php echo $brochurePdf['title'] ?></h2>
<p class="brochures-grid__thematique"><?php echo $rootThematic->name ?></p>
<?php if ($brochureEdition) : ?>
<p class="brochures-grid__edition"><?php echo $brochureEdition ?></p>
<?php endif; ?>
<div class="brochures-grid__button">
<a href="<?php echo $brochurePdf['url'] ?>" class=" cta cta--secondary cta--button" href="#" target="_blank"><?php echo __("Consulter le pdf", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></a>
</div>
</li>
<?php endwhile ?>
<?php endif; ?>
</ul>
<button id="load-more-brochures" class="cta cta--button cta--shadowed" target="_blank"><?php echo __("Consulter toutes les brochures", "homegrade-theme__texte-fonctionnel__publications-archive-brochures") ?></button>
<?php wp_reset_postdata(); ?>
</section>