<?php
    $args = array(
        'category' => 5,
        'post_type' => 'post',
        'numberposts' => -1,
         'orderby' => 'post_date',
        'order' => 'ASC',
        'include' => implode(',', get_option('sticky_posts'))
    );

    $post_list = get_posts($args);
    $nb_article = 0;

    foreach ($post_list as $row) {
        $id_post = $row->ID;
        $post_title = $row->post_title;
        $post_title_formater = trim(str_replace('Circulaires','',$post_title));
        $url_post = get_permalink($id_post);

        if(has_post_thumbnail($id_post)){
            $nb_article++;
            $modulo = $nb_article%24;
            $original = wp_get_attachment_image_url(get_post_thumbnail_id($id_post), 'full' );

            echo '<div class="bloc-marchand">
            <figure class="wp-block-image">
            <a title="'.$post_title.'" href="'.$url_post.'">
            <img class="alignnone size-full wp-image-288" src="'.$original.'" alt="'.$post_title.'" width="200" height="113" />
            </a>
            </figure>
            <h3>'.$post_title_formater.'</h3>
            </div>';

            if($modulo == 0){
                echo '<div class="google-center clearfix">
                    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2412271615838546" crossorigin="anonymous"></script>
                    <!-- Annonces-Horizontales -->
                    <ins class="adsbygoogle"
                         style="display:block"
                         data-ad-client="ca-pub-2412271615838546"
                         data-ad-slot="6105703186"
                         data-ad-format="auto"></ins>
                    <script>
                         (adsbygoogle = window.adsbygoogle || []).push({});
                    </script>
                </div>';
            }
        }
    }
?>