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,24 +1,31 @@
<?php /* Template Name: Repertoire des métiers */ ?>
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
get_header();
$currentLang = do_action('wpml_current_language');
do_action('wpml_switch_language', 'fr');
$pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
do_action('wpml_switch_language', $currentLang);
<?php
// display current blog id
// write_log(get_current_blog_id());
$initialPosts = new WP_Query([
$my_current_lang = apply_filters('wpml_current_language', NULL);
do_action('wpml_switch_language', 'fr');
$pageIcon = get_field('page_icon', 8209) ?? null;
do_action('wpml_switch_language', $my_current_lang);
// write_log($currentLang);
$initialPosts = new WP_Query([
"post_status" => "publish",
"post_type" => "artisans",
"posts_per_page" => -1,
"paged" => 1,
// "paged" => 1,
"orderby" => "title",
"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") ?>">
<?php
$currentPage = get_post(get_queried_object_id());
@ -58,26 +65,29 @@ $initialPosts = new WP_Query([
<?php get_template_part("template-parts/artisan-filter-sidebar", null, array("foundPosts" => $initialPosts->found_posts)); ?>
<div class=" artisans-posts__grid">
<?php while ($initialPosts->have_posts()) : $initialPosts->the_post(); ?>
<?php
foreach ($initialPosts->posts as $key => $artisanPost) {
$post_date = get_the_date('j.m.Y', $artisanPost->ID) ?? null;
$post_date = get_the_date('j.m.Y', $initialPosts->ID) ?? null;
get_template_part(
'template-components/artisans/card-artisans-search',
null,
array(
'card_variant' => 'activite',
'post_ID' => $artisanPost->ID,
'post_title' => get_the_title($artisanPost->ID),
'post_ID' => get_the_ID(),
'post_title' => get_the_title(),
'current_taxonomy' => "elementsbatiments",
'post_date' => $post_date,
)
);
}
?>
); ?>
<?php endwhile; ?>
</div>
</section>
</div>
</div>
<?php endwhile;
endif; ?>
<?php get_footer();