developping page news
This commit is contained in:
parent
f5d952fc9a
commit
4ea1e3c924
67
template-news.php
Normal file
67
template-news.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php /* Template Name: News */
|
||||
get_header();
|
||||
|
||||
$args = array(
|
||||
'meta_key' => '_wp_page_template',
|
||||
'meta_value' => "template-news.php"
|
||||
);
|
||||
$relatedPageTemplatePage = get_pages($args) ? get_pages($args)[0] : null;
|
||||
$pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
|
||||
|
||||
?>
|
||||
<div class="template-archives template-archives--publications">
|
||||
<nav class="breadcrumbs_navigation" aria-label="breadcrumbs">
|
||||
<ol>
|
||||
<li><a href="<?php echo home_url() ?>">Home</a></li>
|
||||
<li><a href="<?php echo get_the_permalink($relatedPageTemplatePage) ?>" aria-current='location'>
|
||||
<?php echo __("News", "homegrade-theme__texte-fonctionnel") ?>
|
||||
</a></li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="heading-box">
|
||||
<img class="heading-box__page-icon" src="<?php echo $pageIcon['url'] ?>" alt="" />
|
||||
<h1 class="heading-box__title"><?php echo get_the_title(get_queried_object_id()) ?></h1>
|
||||
<p class="heading-box__description"> <?php echo __("Qu'y a-t-il de nouveau
|
||||
chez Homegrade ?", "homegrade-theme__texte-fonctionnel") ?></p>
|
||||
</div>
|
||||
|
||||
<div class="filters-toolbar">
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$args = array(
|
||||
"post_type" => "post",
|
||||
"status" => "publish"
|
||||
);
|
||||
$posts = new WP_Query($args);
|
||||
|
||||
?>
|
||||
<div class="card-container">
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
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_tags = get_the_tags($post->ID) ?? null;
|
||||
get_template_part(
|
||||
'template-components/cards/card-news',
|
||||
null,
|
||||
array(
|
||||
'card_variant' => 'activite',
|
||||
'post_ID' => $post->ID,
|
||||
'post_title' => $post->post_title,
|
||||
'post_thumbnail' => $post_thumbnail,
|
||||
'post_tags' => $post_tags,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
get_footer();
|
||||
Loading…
Reference in New Issue
Block a user