Compare commits

...

3 Commits

Author SHA1 Message Date
Antoine M
f7cd19b0ef REBUILDING
All checks were successful
continuous-integration/drone/push Build is passing
2026-05-13 11:53:07 +02:00
Antoine M
a93592ea45 FEATURE Refining the block to display the correct post types 2026-05-13 11:52:45 +02:00
Antoine M
d657b68a9d FEATURE Disable editor for 'analyses-etudes' post type based on term condition 2026-05-12 16:08:56 +02:00
6 changed files with 54 additions and 33 deletions

View File

@ -329,3 +329,42 @@ add_action('admin_menu', function () {
add_filter('menu_order', 'carhop_new_admin_menu_order');
add_filter('custom_menu_order', '__return_true');
});
/* ----------------------------------------------------------------------
DESACTIVATE EDITOR FOR ANALYSES & ETUDES --> Analyse only
------------------------------------------------------------------------*/
function carhop_analyses_etudes_maybe_remove_editor()
{
if (get_current_blog_id() !== 1) {
return;
}
if (!post_type_exists('analyses-etudes')) {
return;
}
$post_id = 0;
if (isset($_GET['post'])) {
$post_id = (int) $_GET['post'];
}
if ($post_id > 0) {
$post = get_post($post_id);
if (!$post || $post->post_type !== 'analyses-etudes') {
return;
}
$is_analyse = has_term('analyse', 'type-analyse-etude', $post_id);
if ($is_analyse) {
remove_post_type_support('analyses-etudes', 'editor');
}
return;
}
if (isset($_GET['post_type']) && $_GET['post_type'] === 'analyses-etudes') {
remove_post_type_support('analyses-etudes', 'editor');
}
}
add_action('load-post.php', 'carhop_analyses_etudes_maybe_remove_editor', 5);
add_action('load-post-new.php', 'carhop_analyses_etudes_maybe_remove_editor', 5);

View File

@ -7,7 +7,7 @@ $featured_items = array();
// QUERY ACTUALITES et AJOUT DES POSTS AU TABLEAU $featured_items
switch_to_blog(1);
$actualites = new WP_Query(array(
'post_type' => 'post',
'post_type' => 'actualites',
'post_status' => 'publish',
'posts_per_page' => $limit,
'orderby' => 'date',
@ -61,9 +61,8 @@ restore_current_blog();
return $b['timestamp'] <=> $a['timestamp'];
});
$featured_items = \array_slice($featured_items, 0, $limit);
?>
<section class="featured-news alignfull has-background" <?php echo get_block_wrapper_attributes(); ?>>
<div class="featured-news__inner">
@ -87,10 +86,13 @@ $featured_items = \array_slice($featured_items, 0, $limit);
$did_switch = true;
}
get_template_part('template-parts/dynamiques/article-card', null, array(
get_template_part('template-parts/components/cards/slider-card', null, array(
'ID' => $item['id'],
'isSwiperSlide' => true,
'showCover' => true,
'showTags' => false,
));
if ($did_switch) {

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '69123d2c012743b30d20');
<?php return array('dependencies' => array(), 'version' => '2534fbdaa8d3fa218c89');

View File

@ -2,27 +2,6 @@
/*!*************************************!*\
!*** ./src/reportages-list/view.js ***!
\*************************************/
document.addEventListener("DOMContentLoaded", function () {
const toolbar = document.querySelector("#press-toolbar");
if (!toolbar) return;
const toolbarButtons = toolbar.querySelectorAll("button");
const ressourcesGridContentWrapper = document.querySelector(".ressources-grid-content-wrapper");
function setActiveTab(currentButton) {
toolbarButtons.forEach(button => {
button.setAttribute("aria-selected", "false");
});
currentButton.setAttribute("aria-selected", "true");
ressourcesGridContentWrapper.setAttribute("data-active-tab", currentButton.getAttribute("data-tab"));
}
function initToolbar() {
toolbarButtons.forEach(button => {
button.addEventListener("click", function () {
setActiveTab(button);
});
});
}
initToolbar();
});
/******/ })()
;
//# sourceMappingURL=view.js.map
;

View File

@ -1 +0,0 @@
{"version":3,"file":"reportages-list/view.js","mappings":";;;;AAAAA,QAAQ,CAACC,gBAAgB,CAAC,kBAAkB,EAAE,YAAY;EACzD,MAAMC,OAAO,GAAGF,QAAQ,CAACG,aAAa,CAAC,gBAAgB,CAAC;EACxD,IAAI,CAACD,OAAO,EAAE;EACd,MAAME,cAAc,GAAGF,OAAO,CAACG,gBAAgB,CAAC,QAAQ,CAAC;EACzD,MAAMC,4BAA4B,GAAGN,QAAQ,CAACG,aAAa,CAC1D,kCACD,CAAC;EAED,SAASI,YAAYA,CAACC,aAAa,EAAE;IACpCJ,cAAc,CAACK,OAAO,CAAEC,MAAM,IAAK;MAClCA,MAAM,CAACC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC;IAC9C,CAAC,CAAC;IAEFH,aAAa,CAACG,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC;IACnDL,4BAA4B,CAACK,YAAY,CACxC,iBAAiB,EACjBH,aAAa,CAACI,YAAY,CAAC,UAAU,CACtC,CAAC;EACF;EAEA,SAASC,WAAWA,CAAA,EAAG;IACtBT,cAAc,CAACK,OAAO,CAAEC,MAAM,IAAK;MAClCA,MAAM,CAACT,gBAAgB,CAAC,OAAO,EAAE,YAAY;QAC5CM,YAAY,CAACG,MAAM,CAAC;MACrB,CAAC,CAAC;IACH,CAAC,CAAC;EACH;EACAG,WAAW,CAAC,CAAC;AACd,CAAC,CAAC,C","sources":["webpack://carhop-blocks/./src/reportages-list/view.js"],"sourcesContent":["document.addEventListener(\"DOMContentLoaded\", function () {\r\n\tconst toolbar = document.querySelector(\"#press-toolbar\");\r\n\tif (!toolbar) return;\r\n\tconst toolbarButtons = toolbar.querySelectorAll(\"button\");\r\n\tconst ressourcesGridContentWrapper = document.querySelector(\r\n\t\t\".ressources-grid-content-wrapper\"\r\n\t);\r\n\r\n\tfunction setActiveTab(currentButton) {\r\n\t\ttoolbarButtons.forEach((button) => {\r\n\t\t\tbutton.setAttribute(\"aria-selected\", \"false\");\r\n\t\t});\r\n\r\n\t\tcurrentButton.setAttribute(\"aria-selected\", \"true\");\r\n\t\tressourcesGridContentWrapper.setAttribute(\r\n\t\t\t\"data-active-tab\",\r\n\t\t\tcurrentButton.getAttribute(\"data-tab\")\r\n\t\t);\r\n\t}\r\n\r\n\tfunction initToolbar() {\r\n\t\ttoolbarButtons.forEach((button) => {\r\n\t\t\tbutton.addEventListener(\"click\", function () {\r\n\t\t\t\tsetActiveTab(button);\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\tinitToolbar();\r\n});\r\n"],"names":["document","addEventListener","toolbar","querySelector","toolbarButtons","querySelectorAll","ressourcesGridContentWrapper","setActiveTab","currentButton","forEach","button","setAttribute","getAttribute","initToolbar"],"ignoreList":[],"sourceRoot":""}

View File

@ -7,7 +7,7 @@ $featured_items = array();
// QUERY ACTUALITES et AJOUT DES POSTS AU TABLEAU $featured_items
switch_to_blog(1);
$actualites = new WP_Query(array(
'post_type' => 'post',
'post_type' => 'actualites',
'post_status' => 'publish',
'posts_per_page' => $limit,
'orderby' => 'date',
@ -61,9 +61,8 @@ restore_current_blog();
return $b['timestamp'] <=> $a['timestamp'];
});
$featured_items = \array_slice($featured_items, 0, $limit);
?>
<section class="featured-news alignfull has-background" <?php echo get_block_wrapper_attributes(); ?>>
<div class="featured-news__inner">
@ -87,10 +86,13 @@ $featured_items = \array_slice($featured_items, 0, $limit);
$did_switch = true;
}
get_template_part('template-parts/dynamiques/article-card', null, array(
get_template_part('template-parts/components/cards/slider-card', null, array(
'ID' => $item['id'],
'isSwiperSlide' => true,
'showCover' => true,
'showTags' => false,
));
if ($did_switch) {