Compare commits

...

5 Commits

Author SHA1 Message Date
abf3ecc992 seamless chantier metabox
All checks were successful
continuous-integration/drone/push Build is passing
2024-12-10 12:15:23 +01:00
43409893b3 refining admin menu orders and displays 2024-12-10 12:14:25 +01:00
20f9eff0b9 refining admin styles 2024-12-10 12:14:07 +01:00
6c9d978993 fiixing translation namespace 2024-12-10 10:17:53 +01:00
fa34a1ce34 removing tests for langage switcher 2024-12-10 10:17:03 +01:00
5 changed files with 93 additions and 26 deletions

View File

@ -1,5 +1,8 @@
<?php get_header(); ?> <?php get_header(); ?>
<?php
// do_action('wpml_language_switcher', array('dropdown' => 1));
?>
<div class="homegrade-page-container homegrade-page-container--metiers-patrimoine"> <div class="homegrade-page-container homegrade-page-container--metiers-patrimoine">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

View File

@ -1,4 +1,15 @@
<?php <?php
/* ---------------------------
REMOVING POSTS FROM ADMIN MENU
---------------------------*/
function post_remove()
{
remove_menu_page('edit.php');
}
add_action('admin_menu', 'post_remove');
/* --------------------------- /* ---------------------------
ADMIN STYLES ADMIN STYLES
---------------------------*/ ---------------------------*/
@ -128,3 +139,48 @@ function add_custom_post_status($post_states, $post)
return $post_states; return $post_states;
} }
add_filter('display_post_states', 'add_custom_post_status', 10, 2); add_filter('display_post_states', 'add_custom_post_status', 10, 2);
/* ----------------------------------------------------------------------
REORDER ADMIN MENU & POST TYPE ORDER ON MENU BAR
------------------------------------------------------------------------*/
/**
* Activates the 'menu_order' filter and then hooks into 'menu_order'
*/
/**
* Filters WordPress' default menu order
*/
function metiers_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(
'edit.php?post_type=chantiers' => 3,
'edit.php?post_type=artisans' => 4,
'edit.php?post_type=page' => 5,
'upload.php' => 7,
'theme-general-settings' => 11,
'rank-math' => 20,
);
// helper function to move an element inside an array
function metiers_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) {
// write_log($value);
if ($current_index = array_search($value, $menu_order)) {
metiers_move_element($menu_order, $current_index, $new_index);
}
}
return $menu_order;
};
add_action('admin_menu', function () {
add_filter('menu_order', 'metiers_new_admin_menu_order');
add_filter('custom_menu_order', '__return_true');
});

View File

@ -110,6 +110,7 @@ function render_custom_chantier_box_content($post)
if ($chantiers->have_posts()) { if ($chantiers->have_posts()) {
echo '<h3> Chantiers réalisé par l\'entreprise </h3>';
echo '<ul>'; echo '<ul>';
while ($chantiers->have_posts()) { while ($chantiers->have_posts()) {
$chantiers->the_post(); $chantiers->the_post();
@ -118,6 +119,7 @@ function render_custom_chantier_box_content($post)
} }
echo '</ul>'; echo '</ul>';
} else { } else {
echo '<h3> Chantiers réalisé par l\'entreprise </h3>';
echo '<p style="font-size: 1rem;">Aucun chantier pour cette entreprise.</p>'; echo '<p style="font-size: 1rem;">Aucun chantier pour cette entreprise.</p>';
} }
} }

View File

@ -146,33 +146,27 @@ body.post-type-artisans {
font-size: revert; font-size: revert;
} }
} }
#menu-posts-conseils,
#menu-posts,
#menu-pages, #menu-pages,
#menu-media { #menu-media {
/* @apply !pt-1; */ @apply !py-1;
border-top: 1px solid rgba(255, 255, 255, 0.2) !important; border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
}
#menu-pages {
border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
}
#menu-pages + .wp-menu-separator {
@apply hidden;
} }
#menu-posts-vocabulaire, #menu-posts-vocabulaire,
#menu-posts-videos-webinaires, #menu-posts-videos-webinaires,
#toplevel_page_theme-general-settings { #toplevel_page_theme-general-settings {
/* @apply !pb-1; */
} }
#toplevel_page_gf_edit_forms { #toplevel_page_gf_edit_forms {
/* @apply !pb-1; */ border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
} }
/* .wp-block-post-content,
.is-root-container {
background-color: red !imporatant;
}
.block-editor-block-list__block {
background-color: yellow !imporatant; */
/* } */
.homegrade-blocks-components-icon__panel-body { .homegrade-blocks-components-icon__panel-body {
.icon-preview { .icon-preview {
@ -230,14 +224,9 @@ body.post-type-artisans {
} }
} }
.block-editor-block-styles__variants .block-editor-block-styles__variants button.components-button.block-editor-block-styles__item.is-active,
button.components-button.block-editor-block-styles__item.is-active, .block-editor-block-styles__variants button.components-button.block-editor-block-styles__item.is-active:hover {
.block-editor-block-styles__variants background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
button.components-button.block-editor-block-styles__item.is-active:hover {
background: var(
--wp-components-color-accent,
var(--wp-admin-theme-color, #3858e9)
);
} }
.components-toggle-group-control-option-base { .components-toggle-group-control-option-base {
div { div {
@ -260,8 +249,15 @@ body.post-type-artisans {
#admin_artisan_chantier_list { #admin_artisan_chantier_list {
h3 { h3 {
@apply pl-0 font-normal; @apply font-medium;
} }
border: 0 none;
background: rgba(0, 0, 0, 0);
box-shadow: none;
> .postbox-header {
@apply !hidden;
}
ul a { ul a {
@apply text-patrimoine-sante-securite text-lg flex items-center gap-2; @apply text-patrimoine-sante-securite text-lg flex items-center gap-2;
filter: brightness(80%); filter: brightness(80%);
@ -277,3 +273,13 @@ body.post-type-artisans {
@apply w-6 h-6 object-contain filter-patrimoine-sante-securite; @apply w-6 h-6 object-contain filter-patrimoine-sante-securite;
} }
} }
#revisionsdiv,
#acf-group_673610d8e548a,
#admin_artisan_chantier_list,
#acf-group_672358433051b,
#rank_math_metabox {
.handle-order-lower,
.handle-order-higher {
@apply !hidden;
}
}

View File

@ -32,7 +32,7 @@ $metiersTerms = get_the_terms($postID, 'metiers');
<div class="card-taxonomies__taxo-container card-taxonomies__taxo-metiers"> <div class="card-taxonomies__taxo-container card-taxonomies__taxo-metiers">
<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-metiers.svg' ?>" alt=''> <img class="card-taxonomies__icon" src="<?php echo get_stylesheet_directory_uri() . '/resources/img/pictogrammes/Homegrade_repertoire-metiers.svg' ?>" alt=''>
<h4 class="card-taxonomies__title"><?php echo __("Métiers du partrimoine", "metiers-patrimoine-theme") ?></h4> <h4 class="card-taxonomies__title"><?php echo __("Métiers du patrimoine", "metiers-patrimoine-theme") ?></h4>
</div> </div>
<div class="taxonomy-tags card-taxonomies__taxonomy-tags"> <div class="taxonomy-tags card-taxonomies__taxonomy-tags">
<?php foreach ($metiersTerms as $key => $term) : ?> <?php foreach ($metiersTerms as $key => $term) : ?>