Compare commits

..

No commits in common. "759004fb67c4fdec21f42d1246e747f08f7464fb" and "5d7396e3f9996c367db5356f36b2e7c3424be453" have entirely different histories.

8 changed files with 30 additions and 212 deletions

View File

@ -17,10 +17,12 @@ function metiers_patrimoine_artisans_post_updater($post_id)
if ($address && isset($address['country'])) { if ($address && isset($address['country'])) {
$stateGenericName = getGenericStateNameFromAcfStateName($address['state']) ?? ""; $stateGenericName = getGenericStateNameFromAcfStateName($address['state']) ?? "";
// write_log($stateGenericName);
// Met à jour le champ personnalisé 'country' avec la valeur du pays de l'adresse // Met à jour le champ personnalisé 'country' avec la valeur du pays de l'adresse
update_post_meta($post_id, 'state', $stateGenericName); update_post_meta($post_id, 'state', $stateGenericName);
} }
// write_log($address);
wp_update_post($my_post); wp_update_post($my_post);
} }
add_action('acf/save_post', 'metiers_patrimoine_artisans_post_updater', 20); add_action('acf/save_post', 'metiers_patrimoine_artisans_post_updater', 20);
@ -61,35 +63,12 @@ CUSTOM CODE FOR TITLE
add_action('edit_form_after_title', function () { add_action('edit_form_after_title', function () {
// Vérifie si on est sur le bon post type // Vérifie si on est sur le bon post type
$screen = get_current_screen(); $screen = get_current_screen();
$last_modified_date = get_the_modified_date('j F Y');
if ($screen && $screen->post_type === 'artisans') { if ($screen && $screen->post_type === 'artisans') {
echo '<h1 class="admin-artisan-title">' . get_the_title() . '</h1>'; echo '<h1 class="admin-artisan-title">' . get_the_title() . '</h1>';
// echo '<p class="last-updated"> Dernière modification : ' . $last_modified_date . '</p>';
} }
}); });
function add_last_modified_date_to_publish_box()
{
global $post;
// Vérifiez que vous êtes dans un post et que l'ID du post est valide
if ($post && $post->ID) {
// Récupérer la date de dernière modification
$dashicon = '<span class="dashicons dashicons-update"></span>';
$last_modified_date = get_the_modified_date('j F Y \à H:i', $post->ID);
// Afficher la date de dernière modification dans le panneau
echo '<div class="misc-pub-section">';
echo $dashicon . ' Dernière update : ';
echo $last_modified_date;
echo '</div>';
}
}
add_action('post_submitbox_start', 'add_last_modified_date_to_publish_box');
/* --------------------------- /* ---------------------------
CUSTOM CHANTIER META BOX AT THE END OF THE PAGE CUSTOM CHANTIER META BOX AT THE END OF THE PAGE
---------------------------*/ ---------------------------*/
@ -146,26 +125,13 @@ function render_custom_chantier_box_content($post)
} }
} }
/* ----------------------------------------------------------------------
SUPPRIMER LA COLONNE RANK MATH SEO SI ELLE EST PRÉSENTE
------------------------------------------------------------------------*/
function remove_rank_math_seo_column_for_artisans($columns)
{
if (isset($columns['rank_math_seo_details'])) {
unset($columns['rank_math_seo_details']);
}
return $columns;
}
// Appliquer le filtre uniquement pour le post type "artisans"
add_filter('manage_artisans_posts_columns', 'remove_rank_math_seo_column_for_artisans', 20);
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
DÉCLARATION DES COLONNES CUSTOM DANS LA LISTE DES POSTS ARTISANS GESTION DE LA COLONNE METIERS DANS LA LISTE DES POSTS ARTISANS
------------------------------------------------------------------------*/ ------------------------------------------------------------------------*/
// **** AJOUT DES COLONNES // AJOUT D'UNE COLONNE CUSTOM
function metiers_patrimoine_artisans_add_acf_posts_columns($columns) function metiers_patrimoine_artisans_add_acf_posts_columns($columns)
{ {
global $current_screen; global $current_screen;
@ -174,42 +140,23 @@ function metiers_patrimoine_artisans_add_acf_posts_columns($columns)
if (isset($columns['date'])) { if (isset($columns['date'])) {
unset($columns['date']); unset($columns['date']);
} }
$customColumns = array( $new_admin_col_arrays = array_slice($columns, 0, 2, true) + array('metiers' => 'Métiers') + array_slice($columns, 2, count($columns) - 2, true);
'metiers' => 'Métiers',
'elements' => 'Éléments du bâtiment',
'conseiller' => 'Conseiller',
'status' => 'Statut',
'lastmodified' => 'Dernière modification',
'onlinedate' => 'Mise en ligne'
);
$new_admin_col_arrays = array_slice($columns, 0, 2, true) + $customColumns + array_slice($columns, 2, count($columns) - 2, true);
return array_merge($new_admin_col_arrays); return array_merge($new_admin_col_arrays);
} }
add_filter('manage_artisans_posts_columns', 'metiers_patrimoine_artisans_add_acf_posts_columns'); add_filter('manage_artisans_posts_columns', 'metiers_patrimoine_artisans_add_acf_posts_columns');
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
GESTION DE LA VALEUR DE CHAQUE COLONNE GESTION DE LA VALEUR DE CHAQUE COLONNE
------------------------------------------------------------------------*/ ------------------------------------------------------------------------*/
function metiers_patrimoine_artisans_handle_posts_custom_columns($column) function metiers_patrimoine_artisans_handle_posts_custom_columns($column)
{ {
$post_id = get_the_ID(); $post_id = get_the_ID();
if ($column == 'conseiller') {
$conseiller = get_field('conseiller', $post_id);
if (!$conseiller) return;
echo $conseiller['user_firstname'] . ' ' . $conseiller['user_lastname'];
}
if ($column == 'status') {
$status = get_field('mdp_status', $post_id);
if (!$status || !isset($status['label'])) return;
echo '<div class="status-state status-state--' . $status['value'] . '">' . $status['label'] . '</div>';
}
if ($column == 'metiers') { if ($column == 'metiers') {
$artisan = get_field('artisan', $post_id);
$terms = get_the_terms($post_id, 'metiers'); $terms = get_the_terms($post_id, 'metiers');
if ($terms) { if ($terms) {
$parent_terms = array_filter($terms, function ($term) { $parent_terms = array_filter($terms, function ($term) {
@ -221,6 +168,7 @@ function metiers_patrimoine_artisans_handle_posts_custom_columns($column)
// } // }
echo '<div class="admin-column-metiers-container">'; echo '<div class="admin-column-metiers-container">';
foreach ($terms as $term) { foreach ($terms as $term) {
// write_log($term);
echo '<a href="' . get_edit_term_link($term->term_id, 'metiers', 'artisans') . '" class="admin-column-taxonomy-term">'; echo '<a href="' . get_edit_term_link($term->term_id, 'metiers', 'artisans') . '" class="admin-column-taxonomy-term">';
echo esc_html($term->name); echo esc_html($term->name);
echo '</a>'; echo '</a>';
@ -230,45 +178,15 @@ function metiers_patrimoine_artisans_handle_posts_custom_columns($column)
echo '<p class="no-results"> × </p>'; echo '<p class="no-results"> × </p>';
} }
} }
if ($column == 'elements') {
$terms = get_the_terms($post_id, 'elementsbatiments');
if ($terms) {
$parent_terms = array_filter($terms, function ($term) {
return $term->parent == 0;
});
echo '<div class="admin-column-metiers-container">';
foreach ($terms as $term) {
echo '<a href="' . get_edit_term_link($term->term_id, 'metiers', 'artisans') . '" class="admin-column-taxonomy-term">';
echo esc_html($term->name);
echo '</a>';
}
echo '</div >';
} else {
echo '<p class="no-results"> × </p>';
}
}
if ($column == 'lastmodified') {
// $last_modified_date = get_the_modified_date('j F Y \à H:i', $post_id);
$last_modified_date = get_the_modified_date('d/m/Y', $post_id);
if (!$last_modified_date) return;
echo $last_modified_date;
}
if ($column == 'onlinedate') {
$published_date = get_the_date('d/m/Y', $post_id);
if (!$published_date) return;
echo $published_date;
}
} }
add_action('manage_artisans_posts_custom_column', 'metiers_patrimoine_artisans_handle_posts_custom_columns', 10, 2); add_action('manage_artisans_posts_custom_column', 'metiers_patrimoine_artisans_handle_posts_custom_columns', 10, 2);
/* ----------------------------------------------------------------------
GESTION DDU FILTRAGES PAR METIERS /* -------------------------------------------
------------------------------------------------------------------------*/ CREATION DU DROPDOWN SELECT AVEC LES OPTIONS
// **** CREATION DU DROPDOWN SELECT AVEC LES OPTIONS ---------------------------------------------*/
function metiers_patrimoine_filter_posts_per_metiers_declare_dropdown() function metiers_patrimoine_filter_posts_per_metiers_declare_dropdown()
{ {
global $pagenow; global $pagenow;
@ -300,7 +218,11 @@ function metiers_patrimoine_filter_posts_per_metiers_declare_dropdown()
} }
add_action('restrict_manage_posts', 'metiers_patrimoine_filter_posts_per_metiers_declare_dropdown'); add_action('restrict_manage_posts', 'metiers_patrimoine_filter_posts_per_metiers_declare_dropdown');
// **** FILTRAGE DES POSTS QUAND LA QUERY DE FILTER EST ENVOYEE
/* ------------------------------------------------------
FILTRAGE DES POSTS QUAND LA QUERY DE FILTER EST ENVOYEE
--------------------------------------------------------*/
function metiers_patrimoine_filter_post_by_metiers_query($query) function metiers_patrimoine_filter_post_by_metiers_query($query)
{ {
global $pagenow; global $pagenow;

View File

@ -8,64 +8,12 @@ body.post-type-artisans {
} }
} }
.post-type-artisans #title {
/* width: 220px; */
}
.post-type-artisans #icl_translations {
width: 40px;
}
.post-type-artisans {
.status-state {
@apply font-medium !rounded-2xl px-2 py-2 w-fit mx-auto;
&--ok {
@apply text-green-700;
}
&--deleted {
@apply text-rose-700;
}
&--to_actualize {
@apply text-amber-600;
}
&--waiting_feedback,
&--new_artisan_to_contact {
@apply text-sky-600;
}
&--being_updated {
@apply text-cyan-600;
}
&--rejected {
@apply text-slate-600;
/* filter: saturate(20%); */
}
}
}
@media screen and (max-width: 1600px) {
#conseiller,
#status,
#lastmodified,
#onlinedate,
.column-lastmodified,
.column-conseiller,
.column-onlinedate,
.column-status {
@apply text-center;
}
#lastmodified,
#onlinedate,
#conseiller {
width: 100px;
}
#status {
width: 140px;
}
}
.iedit.type-artisans.hentry { .iedit.type-artisans.hentry {
.column-title:has(strong > a) { .column-title:has(strong > a) {
color: transparent; color: transparent;
.post-state { .post-state {
@apply px-3 py-1 rounded-2xl font-medium text-xs border border-solid inline-block w-fit; @apply px-3 py-1 rounded-2xl font-medium text-xs border border-solid;
} }
} }
} }
@ -192,9 +140,6 @@ body.post-type-artisans {
.admin-artisan-title { .admin-artisan-title {
@apply text-patrimoine-sante-securite !font-semibold !text-2xl; @apply text-patrimoine-sante-securite !font-semibold !text-2xl;
} }
.last-updated {
@apply text-neutral-500 !text-xs my-0;
}
.edit-post-visual-editor__post-title-wrapper { .edit-post-visual-editor__post-title-wrapper {
h1 { h1 {
@ -394,9 +339,8 @@ ul.striped > :nth-child(odd) {
@apply flex flex-wrap gap-2; @apply flex flex-wrap gap-2;
} }
.column-elements .no-results,
.column-metiers .no-results { .column-metiers .no-results {
@apply text-neutral-400 pl-2; @apply text-neutral-400;
} }
#rank-math-seo-filter { #rank-math-seo-filter {
@ -434,11 +378,3 @@ ul.striped > :nth-child(odd) {
} }
} }
} }
#major-publishing-actions {
@apply !bg-neutral-50;
}
.misc-pub-section.rank-math-seo-score {
@apply !hidden;
}

View File

@ -9,7 +9,6 @@
@import './base/cta.css'; @import './base/cta.css';
@import './base/tags.css'; @import './base/tags.css';
@import './base/filters.css'; @import './base/filters.css';
@import './base/inputs.css';
/* EDITOR CONTENT */ /* EDITOR CONTENT */
@import './editor-content/color-scheme.css'; @import './editor-content/color-scheme.css';

View File

@ -1,29 +0,0 @@
input[type='radio'] {
@apply border-2 border-neutral-800 rounded-full w-5 h-5 grid;
-webkit-appearance: none;
appearance: none;
margin: 0;
font: inherit;
box-sizing: border-box; /* Assurez-vous que les dimensions incluent la bordure */
place-content: center;
transform: translateY(-1px); /* Ajustez avec un pixel entier */
&:checked {
@apply border-neutral-900;
}
}
input[type='radio']::before {
content: '';
width: 10px; /* Taille adaptée sans valeurs fractionnées */
height: 10px; /* Taille adaptée sans valeurs fractionnées */
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
transform: scale(0);
transform-origin: bottom left;
transition: 120ms transform ease-in-out;
box-shadow: inset 1em 1em #171717 !important;
}
input[type='radio']:checked::before {
transform: scale(1); /* Passez à une échelle entière */
}

View File

@ -1,5 +1,5 @@
.highlighted-purple { .highlighted-purple {
@apply font-bold underline-offset-4; @apply font-bold underline underline-offset-4;
} }
.artisans-posts { .artisans-posts {
@ -34,14 +34,6 @@
.posts-results-count { .posts-results-count {
@apply shrink-0; @apply shrink-0;
} }
input[type='radio'] {
@apply shrink-0 mt-2;
}
input[type='radio']:before {
box-shadow: inset 1em 1em #8b2ff7;
}
&__results-indications { &__results-indications {
@apply flex gap-1 items-center flex-wrap; @apply flex gap-1 items-center flex-wrap;
.results-count { .results-count {
@ -93,7 +85,6 @@
h4 { h4 {
@apply my-0; @apply my-0;
} }
.checkbox-choice { .checkbox-choice {
@apply pl-0 pt-1; @apply pl-0 pt-1;
@apply flex flex-wrap; @apply flex flex-wrap;
@ -159,7 +150,7 @@
@apply block !text-neutral-400 font-normal uppercase !text-base tracking-wider mb-4; @apply block !text-neutral-400 font-normal uppercase !text-base tracking-wider mb-4;
} }
.search-radio-card { .search-radio-card {
@apply bg-white rounded-lg p-4 pr-6 shadowed flex items-center justify-between cursor-pointer; @apply bg-white rounded-lg p-4 shadowed flex justify-between cursor-pointer;
label { label {
@apply font-bold; @apply font-bold;
} }

View File

@ -22,15 +22,15 @@
} }
} }
.artisan_wrapper { .artisan_wrapper {
@apply lg:flex gap-10; @apply flex gap-10;
} }
aside { aside {
@apply lg:max-w-sm shrink-0; @apply max-w-sm shrink-0;
} }
.artisans-post { .artisans-post {
&__section { &__section {
@apply !mb-12 pt-12 lg:pt-0; @apply !mb-12;
} }
&__section-title { &__section-title {
@apply text-3xl font-bold !m-0 pb-3; @apply text-3xl font-bold !m-0 pb-3;

View File

@ -2,9 +2,6 @@
@apply bg-white rounded-2xl p-8 border border-neutral-200 mt-6; @apply bg-white rounded-2xl p-8 border border-neutral-200 mt-6;
@apply flex flex-col gap-8 items-start; @apply flex flex-col gap-8 items-start;
&--empty {
@apply hidden;
}
&__titling { &__titling {
@apply flex items-center gap-4; @apply flex items-center gap-4;

View File

@ -9,13 +9,14 @@ $elementsBatimentsTerms = get_the_terms($postID, 'elementsbatiments');
$metiersTerms = get_the_terms($postID, 'metiers'); $metiersTerms = get_the_terms($postID, 'metiers');
$hasEmptyTaxos = (empty($elementsBatimentsTerms) && empty($metiersTerms)) ? 'card-taxonomies--empty' : '';
?> ?>
<article class="card-taxonomies <?php echo $hasEmptyTaxos; ?>"> <article class="card-taxonomies">
<?php if ($elementsBatimentsTerms): ?> <?php if ($elementsBatimentsTerms): ?>
<div class="card-taxonomies__taxo-container card-taxonomies__taxo-elementsbatiments"> <div class="card-taxonomies__taxo-container card-taxonomies__taxo-elementsbatiments">
<div class="card-taxonomies__titling"> <div class="card-taxonomies__titling">
<img class="card-taxonomies__icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-elements.svg' ?>" alt=''> <img class="card-taxonomies__icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-elements.svg' ?>" alt=''>
<h4 class="card-taxonomies__title"><?php echo __("Éléments du bâtiment", "metiers-patrimoine-theme") ?></h4> <h4 class="card-taxonomies__title"><?php echo __("Éléments du bâtiment", "metiers-patrimoine-theme") ?></h4>
@ -40,4 +41,5 @@ $hasEmptyTaxos = (empty($elementsBatimentsTerms) && empty($metiersTerms)) ? 'car
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
</article> </article>