
<center><h2><strong>Ubuntu</strong></h2>
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
/*
Template Name: Blog
*/

get_header();
?>

<div class="header-blog">
  <h1 class="blue-subtitle center-text">Bienvenue sur le blog !</h1>
</div>

<div class="header-content">
  <div class="latest-blog blog-row">
    <?php
    $sticky = get_option('sticky_posts');
    // check if there are any
    if (!empty($sticky)) {
        // override the query
        $args = array(
          'post__in' => $sticky,
            'order'=> 'DESC',
            'orderby' => 'publish_date'
        );
        $the_query = new WP_Query( $args );
        // the loop
        if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
          get_template_part('template-parts/sticky-post-vignette');
          endwhile;
        endif;
    }
   ?>
    <?php
      $args = array(
        'order'=> 'DESC',
        'orderby' => 'publish_date',
        'post_status' => 'publish'
      );
      $the_query = new WP_Query( $args );
      // the loop
      if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
        $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'thumbnail' ); ?>
         <div class="blog-posts-post" style="background-image: linear-gradient(rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.5) 100%), url(<?php echo $url ?>)">
          <div class="blog-posts-post-content">
            <div class="blog-posts-content-cat">
              <?php
                $categories = get_the_category();
                $separator = ' ';
                $output = '';
                if ( ! empty( $categories ) ) {
                    foreach( $categories as $category ) {
                        $output .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" class="article-categories" alt="' . esc_attr( sprintf( __( 'View all posts in %s', 'textdomain' ), $category->name ) ) . '">' . esc_html( $category->name ) . '</a>' . $separator;
                    }
                    echo trim( $output, $separator );
                }
              ?>
            </div>
            <div class="blog-posts-content-title">
              <h2><a href="<?php the_permalink(); ?>">
                <?php
                  $title = get_the_title();
                  $short_title = wp_trim_words( $title, 50, '...' );
                  echo $short_title;
               ?>
              </a></h2>
              <span class="blog-author">Par <strong><?php the_author_posts_link(); ?></strong>, le <?php echo get_the_date(); ?>
              </span>
            </div>
          </div>
        </div>
        <?php
      endwhile;
      endif;
    ?>
  </div>
</div>

 <?php get_footer(); ?>
