Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="col-lg-9 col-12">
- <div class="row">
- <?php
- // global $wp_query, $paged;
- $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
- $args = array(
- 'post_type' => 'noticias' ,
- 'orderby' => 'date' ,
- 'posts_per_page' => '2',
- 'order' => 'DESC' ,
- 'paged' => $paged,
- );
- $wp_query = new WP_Query($args);
- if ($wp_query->have_posts()) :
- while ($wp_query->have_posts()) : $wp_query->the_post();
- $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'full');
- ?>
- <div class="col-md-6 col-12">
- <div class="product__thumb">
- <div class="img-historias"><img src="<?php echo esc_url($featured_img_url); ?>" alt="product image"></div>
- </div>
- <a href="<?php echo get_the_permalink(); ?>"><h4 class="title_historias"><?php the_title(); ?></h4></a>
- <hr>
- <div class="content_historias text-justify"><?php the_excerpt(); ?></div>
- </div>
- <?php
- endwhile;
- $total_pages = $wp_query->max_num_pages;
- if ($total_pages > 1){
- $current_page = max(1, get_query_var('paged'));
- ?>
- <div class="clearfix hide_home"> </div>
- <nav aria-label="Page navigation example">
- <?php
- $links = paginate_links( array(
- 'base' => get_pagenum_link(1) . '%_%',
- 'format' => 'page/%#%',
- 'current' => $current_page,
- 'total' => $total_pages,
- 'prev_next' => false,
- 'type' => 'array'
- ) );
- if ( $links ) :
- echo '<ul class="pagination justify-content-end">';
- // get_previous_posts_link will return a string or void if no link is set.
- if ( $prev_posts_link = get_previous_posts_link( __( 'ยซ' ) ) ) :
- echo '<li class="page-item rounded-0 paginate-prev">';
- echo $prev_posts_link;
- echo '</li>';
- endif;
- echo '<li class="page-item rounded-0">';
- echo join( '</li><li class="page-item">', $links );
- echo '</li>';
- // get_next_posts_link will return a string or void if no link is set.
- if ( $next_posts_link = get_next_posts_link( __( 'ยป' ) ) ) :
- echo '<li class="page-item rounded-0 paginate-next">';
- echo $next_posts_link;
- echo '</li>';
- endif;
- echo '</ul>';
- endif;
- }
- ?>
- </nav>
- <?php
- endif;
- wp_reset_postdata();
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement