• Hello guys

    i have a pege template have a loop from custom post type accroding to custom taxonomies ,

    the problem the pagination don’t work as i using pagenavi
    the code is :

    `<?php
    /* Template Name: orders villas */
    get_header(); ?>
    <div id=”main-content”>
    <?php
    $paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1;

    $args=array(
    ‘paged’ => $paged,
    ‘order’=>’ASC’,
    ‘order_by’=>’date’,
    ‘posts_per_archive_page’=>5,
    ‘post_type’=>’villa’,

    ‘tax_query’ => array(
    array(
    ‘taxonomy’ => ‘catswp’,
    ‘field’ => ‘slug’,
    ‘terms’ => ‘orders’,
    ),
    ),
    );
    $posts=new wp_query($args);
    if($posts->have_posts()) : while($posts->have_posts()) : $posts->the_post();
    $img_src=wp_get_attachment_image_src(get_post_thumbnail_id(),’large’);
    {
    ?>
    <!– show blok –>
    <div class=”showBlock”>
    <span class=”showCode”>
    <?php
    $post_type = get_post_type($last_offer->ID);
    switch( $post_type )
    {
    case ‘lands’:
    echo get_post_meta($post->ID, ‘mf_lcode’, true);
    break;
    case ‘bulids’:
    echo get_post_meta($post->ID, ‘mf_bcode’, true);
    break;
    case ‘villa’:
    echo get_post_meta($post->ID, ‘mf_vcode’, true);
    break;
    case ‘rests’:
    echo get_post_meta($post->ID, ‘mf_rcode’, true);
    break;
    case ‘Palace’:
    echo get_post_meta($post->ID, ‘mf_pcode’, true);
    break;
    }
    ?>
    </span>
    <h2>“><?php the_title(); ?></h2>
    <h3><?php the_excerpt(); ?></h3>
    <div class=”showThum”>
    <img src=”<?php bloginfo(‘template_url’);?>/inc/timthumb.php?src=<?php echo $img_src[0];?>&h=248&w=223&zc=1&q=95″ alt=”<?php the_title(); ?>”>
    <span class=”price”>
    <?php
    $post_type = get_post_type($last_offer->ID);
    switch( $post_type )
    {
    case ‘lands’:
    echo get_post_meta($post->ID, ‘mf_lprice’, true);
    break;
    case ‘bulids’:
    echo get_post_meta($post->ID, ‘mf_bprice’, true);
    break;
    case ‘villa’:
    echo get_post_meta($post->ID, ‘mf_vprice’, true);
    break;
    case ‘rests’:
    echo get_post_meta($post->ID, ‘mf_rprice’, true);
    break;
    case ‘Palace’:
    echo get_post_meta($post->ID, ‘mf_pprice’, true);
    break;
    }
    ?>
    </span>
    <div class=”meta”>
    <ul class=”head”>

    • ?????
    • ?????
    • ??? ?????
    • <ul class=”values”>

    • <?php
      $post_type = get_post_type($last_offer->ID);
      switch( $post_type )
      {
      case ‘lands’:
      echo get_post_meta($post->ID, ‘mf_larea’, true);
      break;
      case ‘bulids’:
      echo get_post_meta($post->ID, ‘mf_barea’, true);
      break;
      case ‘villa’:
      echo get_post_meta($post->ID, ‘mf_varea’, true);
      break;
      case ‘rests’:
      echo get_post_meta($post->ID, ‘mf_rarea’, true);
      break;
      case ‘Palace’:
      echo get_post_meta($post->ID, ‘mf_parea’, true);
      break;
      }
      ?>
    • <?php
      $post_type = get_post_type($last_offer->ID);
      switch( $post_type )
      {
      case ‘lands’:
      echo get_post_meta($post->ID, ‘mf_lage’, true);
      break;
      case ‘bulids’:
      echo get_post_meta($post->ID, ‘mf_bage’, true);
      break;
      case ‘villa’:
      echo get_post_meta($post->ID, ‘mf_vage’, true);
      break;
      case ‘rests’:
      echo get_post_meta($post->ID, ‘mf_rage’, true);
      break;
      case ‘Palace’:
      echo get_post_meta($post->ID, ‘mf_page’, true);
      break;
      }
      ?>
    • <?php
      $post_type = get_post_type($last_offer->ID);
      switch( $post_type )
      {
      case ‘lands’:
      echo get_post_meta($post->ID, ‘mf_lcount’, true);
      break;
      case ‘bulids’:
      echo get_post_meta($post->ID, ‘mf_bcount’, true);
      break;
      case ‘villa’:
      echo get_post_meta($post->ID, ‘mf_vcount’, true);
      break;
      case ‘rests’:
      echo get_post_meta($post->ID, ‘mf_rcount’, true);
      break;
      case ‘Palace’:
      echo get_post_meta($post->ID, ‘mf_pcount’, true);
      break;
      }
      ?>
    • </div>
      </div>
      </div>
      <!– show blok –>
      <?php
      }
      endwhile;
      ?>
      <div class=”clear”></div>

      <?php
      wp_pagenavi();
      wp_reset_postdata();
      else : {
      echo “?? ???? ????? ???? ????? ???????”;
      }
      endif;
      ?>
      </div><!– #content –>
      <?php
      get_footer(); ?>

  • The topic ‘pagination in custom page template have posts from custom post type taxonomy’ is closed to new replies.