feat: new homepage

Fixes #4
This commit is contained in:
Kazhnuz Klappsthul 2021-01-02 19:31:24 +01:00
parent 8e7a93afa6
commit 2cfaf89b3f
3 changed files with 44 additions and 33 deletions

View File

@ -1,40 +1,34 @@
<div id="featured-articles" class="preview-container">
<div id="featured-articles">
<?php
query_posts(array(
query_posts(array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'niveau',
'terms' => 'featured',
'taxonomy' => 'category',
'terms' => 'blog',
'field' => 'slug',
)
),
'orderby' => 'date',
'post_count' => '2',
'order' => 'DESC'
'post_count' => '1',
'order' => 'DESC',
'posts_per_page' => '1'
));
if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<article class="preview">
<a href="<?php the_permalink(); ?>" class="preview-link">
<div class="preview-item" style="background-image:url('<?php echo get_the_post_thumbnail_url(); ?>');">
<div class="preview-overlay">
<div class="preview-categories">
<?php $category = get_the_category();
echo"<span class='badge badge-category'>" . $category[0]->cat_name . "</span>"; ?>
</div>
<h2 class="preview-title"><?php the_title();/*3*/ ?></h2>
</div>
</div>
</a>
</article>
<div class="card card-primary" id="post-<?php the_ID(); ?>">
<div class="card-header"><h1><?php the_title(); ?></h1></div>
<div class="flex-that mb">
<div class="article-category">
<?php $category = get_the_category();
echo"<a href= '" . esc_url( get_category_link( $category[0]->term_id ) ) . "' class='btn-small btn-info'><i class='fa fa-folder'></i> " . $category[0]->cat_name . "</a>"; ?>
</div>
<time itemprop="datePublished"><em><?php the_time('j F Y') ?></em></time>
</div>
<?php the_excerpt(); ?>
<p class="align-center"> <a href="<?php the_permalink(); ?>" class="btn btn-readmore" title="<?php the_title();?>">Lire l'article</a> </p>
</div>
<?php endwhile; ?> <?php wp_reset_query(); /*4*/ ?>
</div>

20
home.php Normal file
View File

@ -0,0 +1,20 @@
<?php get_header(); ?>
<main class="col-md-8">
<!-- Recuperation de la page de home -->
<?php if ( !is_paged() ) {
$page = get_page_by_path( 'home' );
if ($page != null) {
echo '<h1 class="page-title">' . get_the_title( $page ) . '</h1>';
echo '<div>' . $page->post_content . '</div>';
}
echo '<h1 class="page-title">Dernier article</h1>';
include(TEMPLATEPATH . '/components/featured.php');
}
?>
<h1 class="page-title">Publications</h1>
<?php include(TEMPLATEPATH . '/components/preview-list.php'); ?>
</main>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View File

@ -1,10 +1,7 @@
<?php get_header(); ?>
<main class="col-md-8">
<h1 class="page-title"><i class="fa fa-fw fa-star"></i> À la une</h1>
<?php include(TEMPLATEPATH . '/components/featured.php'); ?>
<h1 class="page-title"><i class="fa fa-fw fa-clock-o"></i> Articles récents</h1>
<?php include(TEMPLATEPATH . '/components/posts-list.php'); ?>
<h1 class="page-title">Publications</h1>
<?php include(TEMPLATEPATH . '/components/preview-list.php'); ?>
</main>
<?php get_sidebar(); ?>
<?php get_footer(); ?>