PHP

            
<section>
    <div class="container">
    <h2 class="title is-1"><a href="<?php echo home_url(); ?>/actualites">Actualités 5</a></h2>
        <div class="columns">
          <?php
              $args = array(
                  'posts_per_page' => 3,
              );
              $recent = new WP_Query($args);
              while($recent->have_posts()) : $recent->the_post();
          ?>
            <div class="container is-fluid">
                <div class=" is-centered is-multiline">
                    <div class="dual-line">
                      <?php if (has_post_thumbnail() ) {?>
                        <figure class="">
                          <?php the_post_thumbnail('thumbnail'); ?>
                            <h4 class="title-1"><?php the_title(); ?></h4>
                            <figcaption>
                                <p><?php the_excerpt(); ?></p>
                            </figcaption>
                            <a class="" href="<?php the_permalink(); ?>"></a>                
                        </figure>
                      <?php } else { ?>
                      <?php
                          $curdir=getcwd(); chdir(get_template_directory() . "/css/img/random/");
                          $files=glob("*.{gif,png,jpg,gif}", GLOB_BRACE);
                          chdir($curdir);
                          $file=$files[array_rand($files)];
                      ?>
                        <figure class="">
                            <div class="">
                                <img src="<?php echo(get_bloginfo('template_url')."/css/img/random/$file"); ?>" alt="<?php bloginfo( 'name' ); ?>" />
                            </div>
                            <h4 class="title-1"><?php the_title(); ?></h4>
                            <figcaption>
                                <p><?php the_excerpt(); ?></p>
                            </figcaption>
                            <a class="" href="<?php the_permalink(); ?>"></a>
                        </figure>
                      <?php } ?>      
                    </div>
                </div>
            </div>
          <?php endwhile; ?>
        </div>    
    </div>
</section>
            
        

CSS

            
<style type="text/css">

    .dual-line {
        position: relative;
        overflow: hidden;
        margin: 10px;
        min-width: 230px;
        max-width: 315px;
        width: 100%;
        color: #ffffff;
        text-align: center;
        font-size: 16px;
        background-color: #000000;
    }

    .dual-line *,
    .dual-line *:before,
    .dual-line *:after {
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        -webkit-transition: all 0.55s ease;
        transition: all 0.55s ease;
    }

    .dual-line img {
        max-width: 100%;
        backface-visibility: hidden;
        vertical-align: top;
    }

    .dual-line .title-1 {
        position: absolute;
        top: 58%;
        left: 25px;
        padding: 5px 10px 10px;
    }

    .dual-line .title-1:before,
    .dual-line .title-1:after {
        height: 2px;
        width: 400px;
        position: absolute;
        content: ''
        background-color: #ffffff;
    }

    .dual-line .title-1:before {
        top: 0;
        left: 10px;
        -webkit-transform: translateX(100%);
        transform: translateX(100%);
    }

    .dual-line .title-1:after {
        bottom: 0;
        right: 10px;
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
    }

    .dual-line .title-1 div:before,
    .dual-line .title-1 div:after {
        width: 2px;
        height: 300px;
        position: absolute;
        content: ''
        background-color: #ffffff;
    }

    .dual-line .title-1 div:before {
        top: 10px;
        right: 0;
        -webkit-transform: translateY(100%);
        transform: translateY(100%);
    }

    .dual-line .title-1 div:after {
        bottom: 10px;
        left: 0;
        -webkit-transform: translateY(-100%);
        transform: translateY(-100%);
    }

    
    .dual-line h4 {
        margin: 0;
        text-transform: uppercase;
    }

    
    .dual-line h4 {
        display: block;
        font-weight: 700;
        background-color: #ffffff;
        padding: 5px 10px;
        color: #000000;
        opacity: 0;
    }

    .dual-line figcaption {
        position: absolute;
        bottom: 42%;
        left: 25px;
        text-align: left;
        opacity: 0;
        padding: 5px 60px 5px 10px;
        font-size: 0.8em;
        font-weight: 500;
        letter-spacing: 1.5px;
    }

    .dual-line  p {
        margin: 0;
    }

    .dual-line a {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
    }

    .dual-line:hover img{
        zoom: 1;
        filter: alpha(opacity=25);
        -webkit-opacity: 0.25;
        opacity: 0.25;
    }

    .dual-line:hover .title-1:before,
    .dual-line:hover .title-1:after,
    .dual-line:hover .title-1 div:before,
    .dual-line:hover .title-1 div:after{
        -webkit-transform: translate(0, 0);
        transform: translate(0, 0);
    }

    .dual-line:hover .title-1:before,
    .dual-line:hover .title-1:after{
        -webkit-transition-delay: 0.15s;
        transition-delay: 0.15s;
    }

    .dual-line:hover h4{
        opacity: 1;
        -webkit-transition-delay: 0.2s;
        transition-delay: 0.2s;
    }

    .dual-line:hover figcaption{
        opacity: 1;
        -webkit-transition-delay: 0.2s;
        transition-delay: 0.2s;
    }

</style>