FIX Fixing broken permalinks

This commit is contained in:
Nonimart 2025-07-22 14:53:18 +02:00
parent b533847421
commit 62e5195c0f

View File

@ -1,23 +1,30 @@
<?php /* Template Name: Repertoire des métiers */ ?> <?php /* Template Name: Repertoire des métiers */ ?>
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php <?php
get_header(); // display current blog id
$currentLang = do_action('wpml_current_language'); // write_log(get_current_blog_id());
$my_current_lang = apply_filters('wpml_current_language', NULL);
do_action('wpml_switch_language', 'fr'); do_action('wpml_switch_language', 'fr');
$pageIcon = get_field('page_icon', get_queried_object_id()) ?? null; $pageIcon = get_field('page_icon', 8209) ?? null;
do_action('wpml_switch_language', $currentLang); do_action('wpml_switch_language', $my_current_lang);
// write_log($currentLang);
$initialPosts = new WP_Query([ $initialPosts = new WP_Query([
"post_status" => "publish", "post_status" => "publish",
"post_type" => "artisans", "post_type" => "artisans",
"posts_per_page" => -1, "posts_per_page" => -1,
"paged" => 1, // "paged" => 1,
"orderby" => "title", "orderby" => "title",
"order" => "ASC", "order" => "ASC",
// "suppress_filters" => false,
]); ]);
?> ?>
<div class="homegrade-page-container metiers-patrimoine-page-container--repertoire-metiers"> <div class="homegrade-page-container metiers-patrimoine-page-container--repertoire-metiers">
<nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "metiers-patrimoine-theme") ?>"> <nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "metiers-patrimoine-theme") ?>">
<?php <?php
@ -58,26 +65,29 @@ $initialPosts = new WP_Query([
<?php get_template_part("template-parts/artisan-filter-sidebar", null, array("foundPosts" => $initialPosts->found_posts)); ?> <?php get_template_part("template-parts/artisan-filter-sidebar", null, array("foundPosts" => $initialPosts->found_posts)); ?>
<div class=" artisans-posts__grid"> <div class=" artisans-posts__grid">
<?php while ($initialPosts->have_posts()) : $initialPosts->the_post(); ?>
<?php <?php
foreach ($initialPosts->posts as $key => $artisanPost) { $post_date = get_the_date('j.m.Y', $initialPosts->ID) ?? null;
$post_date = get_the_date('j.m.Y', $artisanPost->ID) ?? null;
get_template_part( get_template_part(
'template-components/artisans/card-artisans-search', 'template-components/artisans/card-artisans-search',
null, null,
array( array(
'card_variant' => 'activite', 'card_variant' => 'activite',
'post_ID' => $artisanPost->ID, 'post_ID' => get_the_ID(),
'post_title' => get_the_title($artisanPost->ID), 'post_title' => get_the_title(),
'current_taxonomy' => "elementsbatiments", 'current_taxonomy' => "elementsbatiments",
'post_date' => $post_date, 'post_date' => $post_date,
) )
); ); ?>
} <?php endwhile; ?>
?>
</div> </div>
</section> </section>
</div> </div>
<?php endwhile;
endif; ?>
<?php get_footer(); <?php get_footer();