Advertisement
campusboy

Untitled

Jan 28th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?
  2.  
  3. $project_ids = get_field( 'project_this' );
  4. $offset      = get_query_var( 'paged' ) > 1 ? get_query_var( 'paged' ) * 3 - 3 : 1;
  5.  
  6. $args = [
  7.     'post_type'      => 'portfolio',
  8.     'orderby'        => 'id',
  9.     'order'          => 'ASC',
  10.     'post__in'       => wp_parse_id_list( $project_ids ),
  11.     'posts_per_page' => 3,
  12.     'offset'         => $offset,
  13. ];
  14.  
  15. global $wp_query;
  16. $i        = 0;
  17. $wp_query = new WP_Query( $args );
  18. if ( have_posts() ) : while ( have_posts() ) : the_post();
  19.     $i ++; ?>
  20.  
  21.     <div class="col-md-12 project-item project-item-<?= $i ?>" data-id="<?
  22.     the_ID() ?>">
  23.         content
  24.     </div>
  25. <?endwhile;
  26. endif;
  27.  
  28. $argspagi = [];
  29. $argspagi = [
  30.     'prev_next' => true,
  31.     'prev_text' => __( '<i class="fa fa-long-arrow-left"></i>' ),
  32.     'next_text' => __( '<i class="fa fa-long-arrow-right"></i>' ),
  33.     'type'      => 'plain',
  34. ];
  35. the_posts_pagination( $argspagi );
  36. wp_reset_query();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement