wordpress分页显示空白?

时间:2014-09-16 15:03:50

标签: php wordpress pagination

我的问题就在这里当我点击分页页面时,例如1 2 4,当我点击任何人显示空白页面时。请帮我 ?哪里我错了。

<?php
  global $wpdb;
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
$limit = 7;
 $offset = ($pagenum-1) * $limit;
 $total = $wpdb->get_var( "SELECT COUNT(*) FROM $protype" );
 $num_of_pages = ceil( $total / $limit );

  $qry="select * from $protype LIMIT $offset, $limit";
$result=$wpdb->get_results($qry);
if($result):
foreach($result as $results)
{
    ?>        
 <div class="left_show">
<div class="s_right">
<?php
 echo "<p>$".$results->Addl_mo_fee." for sale</p>";
 echo "<p>mls#:".$results->Ml_num."<br/></p>";
  echo "<p>Lot Size:".$results->Lp_dol."Sq.ft<br/></p>";
echo "<p>Lot Size:".$results->S_r."Sq.ft<br/></p>";

?>
<a class="view_bt" href="<?php echo $urls;?>/?Property=<?php echo $results->Ml_num; ?   >&ptype=<?php echo $protype; ?>"> View More Details &amp; Photos </a>
 </div>
 <div class="le_show">
<img src="<?php echo $url.$results->Ml_num;?>/0.jpg" width="220" height="200" bo rder="0">    
   </div>

  <div class="clear"></div> 
  </div>
    <?php

}

//Link for Pagination
$page_links = paginate_links( array(
    'base' => add_query_arg( 'pagenum', '%#%' ),
    'format' => '',
    'prev_text' => __( '&laquo;', 'aag' ),
    'next_text' => __( '&raquo;', 'aag' ),
    'total' => $num_of_pages,
    'current' => $pagenum
) );
if ( $page_links ) {
    echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
  }
 endif;
   }
  }
    ?>
谢谢先生,请帮助我,请检查我的代码以及我错在哪里也建议我。 提前谢谢你。

0 个答案:

没有答案