Advertisement
rakeshr

pagination not working in custom post type

Nov 8th, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.75 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Applications
  4. */
  5.  
  6.  
  7.  
  8. get_header(); ?>
  9.  
  10. <div id="ppagewrapper" >       
  11.  
  12.  
  13.  
  14.  
  15. <?php
  16. //list terms in a given taxonomy
  17. $taxonomy = 'apptypes';
  18. $appargs=array(
  19.   'hide_empty' => false,
  20.   'orderby' => 'name',
  21.   'order' => 'ASC',
  22.   'parent' => '0'
  23. );
  24. $appterms = get_terms($taxonomy,$appargs);
  25. ?>
  26.  
  27. <?php
  28. foreach ($appterms as $appterm) {
  29.  
  30. $termID = $appterm->term_id;
  31. $taxonomyName = $taxonomy;
  32. $termchildren = get_term_children( $termID, $taxonomyName );
  33. foreach ($termchildren as $child) {
  34.     $termsub = get_term_by( 'id', $child, $taxonomyName );
  35.     echo '<div style="margin:0 auto; width="100%"><h2>'. $appterm->name.'</h2></div>';
  36.     echo $termsub->name;
  37.  
  38.  
  39.   $wpq = array (
  40.     'posts_per_page' => get_option('posts_per_page'),
  41.     'paged' => $paged,
  42.     'taxonomy' => $taxonomy,
  43.     'term' => $termsub->slug
  44. );
  45. $query = new WP_Query ($wpq);
  46. $article_count = $query->post_count;
  47. echo '<table width="98%" border="0" cellspacing="0" cellpadding="5"  class="customtable">
  48.  <tr class="customhead">
  49.    <td align="left" valign="top">Year</td>
  50.    <td align="left" valign="top">Kit Name</td>
  51.    <td align="left" valign="top">Kit</td>
  52.  </tr>
  53.   <tr><td colspan="3">'.term_description($termsub->term_id,$taxonomyName) .'</td></tr>';   
  54.  
  55. if ($article_count) {
  56. $posts = $query->posts;
  57. foreach ($posts as $post) {
  58. include(MY_THEME_FOLDER . '/appsloop.php');
  59. }
  60. }
  61. echo ' </table>'; ?>
  62.  
  63.   <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  64. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  65.  
  66. <?php } }
  67. ?>
  68. </ul>
  69.  
  70.  
  71.    
  72.   </div>
  73.    
  74.  
  75.  
  76.  
  77. <?php get_footer(); ?>
  78.  
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement