Compare commits
3 Commits
3d0429d08a
...
9672bf6d04
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9672bf6d04 | ||
|
|
62e5195c0f | ||
|
|
b533847421 |
|
|
@ -24,7 +24,7 @@ function build_search_artisan_posts_cards($request)
|
||||||
$StringifiedTaxonomyIds = esc_html($request->get_param('taxonomy-ids')) ?? null;
|
$StringifiedTaxonomyIds = esc_html($request->get_param('taxonomy-ids')) ?? null;
|
||||||
|
|
||||||
do_action('wpml_switch_language', $currentLanguage);
|
do_action('wpml_switch_language', $currentLanguage);
|
||||||
$lang = apply_filters('wpml_current_language', null);
|
// $lang = apply_filters('wpml_current_language', null);
|
||||||
$taxonomyIds = explode(',', $StringifiedTaxonomyIds);
|
$taxonomyIds = explode(',', $StringifiedTaxonomyIds);
|
||||||
$taxonomyIds = array_map('intval', $taxonomyIds);
|
$taxonomyIds = array_map('intval', $taxonomyIds);
|
||||||
$search_value = sanitize_text_field($request->get_param('search')) ?? null;
|
$search_value = sanitize_text_field($request->get_param('search')) ?? null;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
$current_lang = apply_filters('wpml_current_language', null);
|
||||||
|
|
||||||
$postID = $args['post_ID'];
|
$postID = $args['post_ID'];
|
||||||
$post_thumbnail = get_the_post_thumbnail($postID, 'full', array('class' => 'card-artisans__thumbnail card-post__thumbnail')) ?? null;
|
$post_thumbnail = get_the_post_thumbnail($postID, 'full', array('class' => 'card-artisans__thumbnail card-post__thumbnail')) ?? null;
|
||||||
$postDefautlThumbnail = get_stylesheet_directory_uri() . '/resources/img/illustrations/Homegrade_resultats-filtres.svg';
|
$postDefautlThumbnail = get_stylesheet_directory_uri() . '/resources/img/illustrations/Homegrade_resultats-filtres.svg';
|
||||||
|
|
||||||
|
|
||||||
$post_title = $args['post_title'];
|
$post_title = $args['post_title'];
|
||||||
$post_permalink = get_the_permalink($postID);
|
$post_permalink = get_the_permalink($postID);
|
||||||
|
$post_guid = get_the_guid($postID);
|
||||||
$company_members = get_field('company_members', $postID);
|
$company_members = get_field('company_members', $postID);
|
||||||
$currentTaxonomy = $args['current_taxonomy'];
|
$currentTaxonomy = $args['current_taxonomy'];
|
||||||
|
|
||||||
// $taxonomyTerms = $currentTaxonomy === "elementsbatiments" ? get_the_terms($postID, 'elementsbatiments') : get_the_terms($postID, 'metiers');
|
|
||||||
$taxonomySortedTerms = $currentTaxonomy === "elementsbatiments" ? get_the_terms_organised_by_parent('elementsbatiments', $postID) : get_the_terms_organised_by_parent('metiers', $postID);
|
$taxonomySortedTerms = $currentTaxonomy === "elementsbatiments" ? get_the_terms_organised_by_parent('elementsbatiments', $postID) : get_the_terms_organised_by_parent('metiers', $postID);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -19,11 +24,14 @@ $website = get_field('website', $postID);
|
||||||
|
|
||||||
$adresse = get_field('adresse', $postID);
|
$adresse = get_field('adresse', $postID);
|
||||||
$cover_image = get_field('artisan_cover', $postID);
|
$cover_image = get_field('artisan_cover', $postID);
|
||||||
|
|
||||||
|
$wpml_fixed_permalink = apply_filters('wpml_permalink', $post_guid, $current_lang);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<article class="card-artisans">
|
<article class="card-artisans">
|
||||||
<a href="<?php echo get_the_permalink($postID) ?>" class="card-artisans__cover-container">
|
<a href="<?php echo $wpml_fixed_permalink ?>" class="card-artisans__cover-container">
|
||||||
<?php if ($cover_image): ?>
|
<?php if ($cover_image): ?>
|
||||||
<img src="<?php echo $cover_image['url'] ?>" alt="<?php echo $post_title ?>" class="card-artisans__cover-image">
|
<img src="<?php echo $cover_image['url'] ?>" alt="<?php echo $post_title ?>" class="card-artisans__cover-image">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
@ -32,7 +40,7 @@ $cover_image = get_field('artisan_cover', $postID);
|
||||||
</a>
|
</a>
|
||||||
<div class="card-artisans__inner">
|
<div class="card-artisans__inner">
|
||||||
|
|
||||||
<a href="<?php echo get_the_permalink($postID) ?>" class="card-artisans__title-container">
|
<a href="<?php echo $wpml_fixed_permalink ?>" class="card-artisans__title-container">
|
||||||
<h2 class="card-artisans__title"><?php echo $post_title ?></h2>
|
<h2 class="card-artisans__title"><?php echo $post_title ?></h2>
|
||||||
</a>
|
</a>
|
||||||
<?php if ($company_members): ?>
|
<?php if ($company_members): ?>
|
||||||
|
|
@ -68,7 +76,7 @@ $cover_image = get_field('artisan_cover', $postID);
|
||||||
|
|
||||||
<a class="card-artisans__website" href="<?php echo $website ?>" target="_blank"><?php echo $clean_website ?></a>
|
<a class="card-artisans__website" href="<?php echo $website ?>" target="_blank"><?php echo $clean_website ?></a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<a href=" <?php echo get_the_permalink($postID) ?>" class="cta cta--read-more cta--with-arrow-button ">
|
<a href=" <?php echo $wpml_fixed_permalink ?>" class="cta cta--read-more cta--with-arrow-button ">
|
||||||
<span><?php echo __("En savoir plus", 'metiers-patrimoine-theme') ?></span>
|
<span><?php echo __("En savoir plus", 'metiers-patrimoine-theme') ?></span>
|
||||||
<span class="sr-only"> <?php echo $post_title ?></span>
|
<span class="sr-only"> <?php echo $post_title ?></span>
|
||||||
<img class="cta_arrow_button" src='<?php echo get_template_directory_uri() ?>/resources/img/graphic-assets/arrow-right-circle.svg' alt=''>
|
<img class="cta_arrow_button" src='<?php echo get_template_directory_uri() ?>/resources/img/graphic-assets/arrow-right-circle.svg' alt=''>
|
||||||
|
|
|
||||||
|
|
@ -1,83 +1,93 @@
|
||||||
<?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
|
|
||||||
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);
|
|
||||||
|
|
||||||
$initialPosts = new WP_Query([
|
|
||||||
"post_status" => "publish",
|
|
||||||
"post_type" => "artisans",
|
|
||||||
"posts_per_page" => -1,
|
|
||||||
"paged" => 1,
|
|
||||||
"orderby" => "title",
|
|
||||||
"order" => "ASC",
|
|
||||||
]);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<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
|
<?php
|
||||||
$currentPage = get_post(get_queried_object_id());
|
// display current blog id
|
||||||
$networkHomeUrl = network_home_url();
|
// write_log(get_current_blog_id());
|
||||||
|
|
||||||
$frontPageUrl = get_home_url();
|
$my_current_lang = apply_filters('wpml_current_language', NULL);
|
||||||
$frontPageTitle = get_the_title(get_option('page_on_front'));
|
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,
|
||||||
|
"orderby" => "title",
|
||||||
|
"order" => "ASC",
|
||||||
|
// "suppress_filters" => false,
|
||||||
|
]);
|
||||||
?>
|
?>
|
||||||
<ol>
|
|
||||||
<li>
|
|
||||||
<a href="<?php echo $networkHomeUrl ?>" title="<?php echo __("Accueil", "metiers-patrimoine-theme") ?>">
|
|
||||||
<img src="<?php echo get_template_directory_uri() . "/resources/img/pictogrammes/icon_house_dark.svg" ?>" alt="">
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li><a href="<?php echo $frontPageUrl ?>"><?php echo $frontPageTitle ?></a></li>
|
|
||||||
|
|
||||||
<?php if ($currentPage) : ?>
|
<div class="homegrade-page-container metiers-patrimoine-page-container--repertoire-metiers">
|
||||||
<li><a href="<?php echo get_post_permalink($currentPage->ID) ?>" aria-current="location" aria-disabled="true"><?php echo $currentPage->post_title ?></a></li>
|
<nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "metiers-patrimoine-theme") ?>">
|
||||||
<?php endif; ?>
|
<?php
|
||||||
|
$currentPage = get_post(get_queried_object_id());
|
||||||
|
$networkHomeUrl = network_home_url();
|
||||||
|
|
||||||
</ol>
|
$frontPageUrl = get_home_url();
|
||||||
</nav>
|
$frontPageTitle = get_the_title(get_option('page_on_front'));
|
||||||
|
?>
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<a href="<?php echo $networkHomeUrl ?>" title="<?php echo __("Accueil", "metiers-patrimoine-theme") ?>">
|
||||||
|
<img src="<?php echo get_template_directory_uri() . "/resources/img/pictogrammes/icon_house_dark.svg" ?>" alt="">
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<?php /* --------
|
<li><a href="<?php echo $frontPageUrl ?>"><?php echo $frontPageTitle ?></a></li>
|
||||||
|
|
||||||
|
<?php if ($currentPage) : ?>
|
||||||
|
<li><a href="<?php echo get_post_permalink($currentPage->ID) ?>" aria-current="location" aria-disabled="true"><?php echo $currentPage->post_title ?></a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<?php /* --------
|
||||||
HEADING BOX
|
HEADING BOX
|
||||||
---------------*/ ?>
|
---------------*/ ?>
|
||||||
<?php
|
|
||||||
get_template_part("template-components/heading-box", null, array(
|
|
||||||
"pageIcon" => $pageIcon,
|
|
||||||
"title" => $currentPage->post_title,
|
|
||||||
"description" => __("Cherchez une entreprise ou un artisan", "metiers-patrimoine-theme"),
|
|
||||||
));
|
|
||||||
?>
|
|
||||||
|
|
||||||
<section class="artisans-posts">
|
|
||||||
<?php get_template_part("template-parts/artisan-filter-sidebar", null, array("foundPosts" => $initialPosts->found_posts)); ?>
|
|
||||||
|
|
||||||
<div class=" artisans-posts__grid">
|
|
||||||
<?php
|
<?php
|
||||||
foreach ($initialPosts->posts as $key => $artisanPost) {
|
get_template_part("template-components/heading-box", null, array(
|
||||||
$post_date = get_the_date('j.m.Y', $artisanPost->ID) ?? null;
|
"pageIcon" => $pageIcon,
|
||||||
|
"title" => $currentPage->post_title,
|
||||||
get_template_part(
|
"description" => __("Cherchez une entreprise ou un artisan", "metiers-patrimoine-theme"),
|
||||||
'template-components/artisans/card-artisans-search',
|
));
|
||||||
null,
|
|
||||||
array(
|
|
||||||
'card_variant' => 'activite',
|
|
||||||
'post_ID' => $artisanPost->ID,
|
|
||||||
'post_title' => get_the_title($artisanPost->ID),
|
|
||||||
'current_taxonomy' => "elementsbatiments",
|
|
||||||
'post_date' => $post_date,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<section class="artisans-posts">
|
||||||
|
<?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
|
||||||
|
$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' => get_the_ID(),
|
||||||
|
'post_title' => get_the_title(),
|
||||||
|
'current_taxonomy' => "elementsbatiments",
|
||||||
|
'post_date' => $post_date,
|
||||||
|
)
|
||||||
|
); ?>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<?php endwhile;
|
||||||
|
endif; ?>
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php get_footer();
|
<?php get_footer();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user