updating news_type taxonomy to be better handled by javascript

This commit is contained in:
Antoine M 2023-11-07 10:18:04 +01:00
parent 1905ffa495
commit 2adb2be068
3 changed files with 10 additions and 10 deletions

View File

@ -107,7 +107,7 @@ function get_news_posts_per_type_id($request)
"posts_per_page" => -1, "posts_per_page" => -1,
"tax_query" => array( "tax_query" => array(
array( array(
'taxonomy' => 'news-type', 'taxonomy' => 'news_type',
'field' => 'term_id', 'field' => 'term_id',
'terms' => $typeId 'terms' => $typeId
) )
@ -133,8 +133,8 @@ function build_news_posts_feed_all($request)
ob_start(); ob_start();
foreach ($newsPostsDatas as $key => $post) { foreach ($newsPostsDatas as $key => $post) {
$post_thumbnail = get_the_post_thumbnail($post->ID, 'full', array('class' => 'card-news__thumbnail card-post__thumbnail')) ?? null; $post_thumbnail = get_the_post_thumbnail($post->ID, 'full', array('class' => 'card-news__thumbnail card-post__thumbnail')) ?? null;
$news_type = get_the_terms($post->ID, "news-type") ?? null; $news_type = get_the_terms($post->ID, "news_type") ?? null;
write_log($news_type); // write_log($news_type);
get_template_part( get_template_part(
'template-components/cards/card-news', 'template-components/cards/card-news',
null, null,
@ -165,7 +165,7 @@ function build_news_posts_feed_per_type_id($request)
"posts_per_page" => -1, "posts_per_page" => -1,
"tax_query" => array( "tax_query" => array(
array( array(
'taxonomy' => 'news-type', 'taxonomy' => 'news_type',
'field' => 'term_id', 'field' => 'term_id',
'terms' => $typeId 'terms' => $typeId
) )
@ -177,7 +177,7 @@ function build_news_posts_feed_per_type_id($request)
ob_start(); ob_start();
foreach ($newsPostsDatas as $key => $post) { foreach ($newsPostsDatas as $key => $post) {
$post_thumbnail = get_the_post_thumbnail($post->ID, 'full', array('class' => 'card-news__thumbnail card-post__thumbnail')) ?? null; $post_thumbnail = get_the_post_thumbnail($post->ID, 'full', array('class' => 'card-news__thumbnail card-post__thumbnail')) ?? null;
$news_type = get_the_terms($post->ID, "news-type") ?? null; $news_type = get_the_terms($post->ID, "news_type") ?? null;
get_template_part( get_template_part(
'template-components/cards/card-news', 'template-components/cards/card-news',
null, null,

View File

@ -41,7 +41,7 @@ $relatedPageTemplatePage = get_pages($args) ? get_pages($args)[0] : null;
---------------*/ ?> ---------------*/ ?>
<?php <?php
get_template_part("template-components/news-heading-box", null, array( get_template_part("template-components/news-heading-box", null, array(
"news_type" => get_the_terms(get_the_ID(), 'news-type'), "news_type" => get_the_terms(get_the_ID(), 'news_type'),
"title" => get_the_title(), "title" => get_the_title(),
"thumbnail" => get_the_post_thumbnail(get_the_ID(), "full", array('class' => 'news-heading-box__thumbnail')), "thumbnail" => get_the_post_thumbnail(get_the_ID(), "full", array('class' => 'news-heading-box__thumbnail')),
"published" => get_the_date() "published" => get_the_date()

View File

@ -44,8 +44,8 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
<ul class="filters-toolbar filters-toolbar--archive-news"> <ul class="filters-toolbar filters-toolbar--archive-news">
<?php <?php
$news_types = get_terms(array( $news_types = get_terms(array(
'taxonomy' => 'news-type', 'taxonomy' => 'news_type',
'hide_empty' => true, 'hide_empty' => false,
)); ));
?> ?>
@ -55,7 +55,7 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
<?php foreach ($news_types as $typeTerm) : ?> <?php foreach ($news_types as $typeTerm) : ?>
<?php <?php
$termIcon = get_field('news_type_icon', "news-type" . '_' . $typeTerm->term_id) ?? null; $termIcon = get_field('news_type_icon', "news_type" . '_' . $typeTerm->term_id) ?? null;
?> ?>
<li> <li>
@ -93,7 +93,7 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
<?php <?php
foreach ($posts->posts as $key => $post) { foreach ($posts->posts as $key => $post) {
$post_thumbnail = get_the_post_thumbnail($post->ID, 'full', array('class' => 'card-news__thumbnail card-post__thumbnail')) ?? null; $post_thumbnail = get_the_post_thumbnail($post->ID, 'full', array('class' => 'card-news__thumbnail card-post__thumbnail')) ?? null;
$news_type = get_the_terms($post->ID, "news-type") ?? null; $news_type = get_the_terms($post->ID, "news_type") ?? null;
get_template_part( get_template_part(
'template-components/cards/card-news', 'template-components/cards/card-news',