Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #604408

    Hello, the team ,

    i have a page in which there’s a widget area. this widget contains some php code to display a loop :

    <?php
    if ( get_query_var('paged') ) $paged = get_query_var('paged');  
    if ( get_query_var('page') ) $paged = get_query_var('page');
     
    $query = new WP_Query( array( 'post_type' => 'conseils-municipaux', 'paged' => $paged, 'posts_per_page' => 4 ) );
    
    // The Query
    if ( $query->have_posts() ) : ?>
    <div class="entry-content" itemprop="text"><div class="avia-data-table-wrap avia_responsive_table">
    <table class="avia-table avia-data-table avia-table-1 avia-builder-el-0  avia-builder-el-no-sibling" itemscope="itemscope" itemtype="https://schema.org/Table">
    <tbody>
    <tr class="avia-heading-row">
    <th class="">Conseil municipal</th>
    <th class="" style="white-space : nowrap;!important">Date et heure</th>
    <th class="">Nombre de délibérations</th>
    <th class="">Compte-rendu</th>
    <th class="">Procès verbal</th>
    </tr>
    <?php // The Loop
    while ( $query->have_posts() ) : $query->the_post(); ?>
    <tr class="">
    <td class=""  style="vertical-align:middle!important"><?php the_field('conseil_municipal'); ?></td>
    <td class="" style="vertical-align:middle!important"><?php the_field('conseil_municipale_date_et_heure'); ?></td>
    <td class="" align="center" style="vertical-align:middle!important"><?php the_field('conseil_municipal_nombre_de_deliberations'); ?></td>
    <td class="" align="center" style="vertical-align:middle!important"><a href="<?php the_field('conseil_municipal_compte-rendu'); ?>" target="_blank" class="avia-button  avia-icon_select-yes-left-icon avia-color-grey avia-size-small avia-position-center" ><span class="avia_button_icon avia_button_icon_left" aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span><span class="avia_iconbox_title">Voir</span></a></td>
    <td class="" align="center" style="vertical-align:middle!important"><a href="<?php the_field('conseil_municipal_procès_verbal'); ?>" target="_blank" class="avia-button avia-icon_select-yes-left-icon avia-color-grey avia-size-small avia-position-center"><span class="avia_button_icon avia_button_icon_left" aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span><span class="avia_iconbox_title">Voir</span></a></td>
    </tr>
    <?php endwhile; wp_reset_postdata(); 
    
    endif;
    ?>
    </tbody>
    </table>
    <?php echo "<div class='custom-pagination}'>".avia_pagination('', 'nav')."</div>"; ?>
    </div>
    </div>

    Everything is ok except that the pagination is not displayed

    Is it possible to make it ?

    Thank you for your help.

    Best regards

    #604452

    Hey!

    You’re missing the first parameter in avia_pagination:

    $query->max_num_pages
    

    Best regards,
    Josue

    #604559

    Great Josue !

    Thank you for everything.

    Best regards

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Pagination in a custom loop in a widget’ is closed to new replies.