Advertisement
deepbevel

query category pagination

Jan 4th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. <?php
  2. /**
  3. * The template for displaying all pages.
  4. *
  5. * This is the template that displays all pages by default.
  6. * Please note that this is the WordPress construct of pages
  7. * and that other 'pages' on your WordPress site will use a
  8. * different template.
  9. *
  10. * @package WordPress
  11. * @subpackage Twenty_Ten
  12. * @since Twenty Ten 1.0
  13. */
  14.  
  15. get_header(); ?>
  16.  
  17. <div id="container">
  18. <div id="content" role="main">
  19.  
  20.  
  21. <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
  22.  
  23. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  24. <?php if ( is_front_page() ) { ?>
  25. <h2 class="entry-title"><?php the_title(); ?></h2>
  26. <?php } else { ?>
  27. <h1 class="entry-title"><?php the_title(); ?></h1>
  28. <?php } ?>
  29.  
  30. <div class="entry-content">
  31. <?php the_content(); ?>
  32. <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
  33. <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
  34. </div><!-- .entry-content -->
  35. </div><!-- #post-## -->
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. <?php if (is_page('test2')) { ?>
  43.  
  44. <?/*THIS IS THE BASIC QUERY CODE*/?>
  45.  
  46. <?php
  47.  
  48. query_posts( array( 'posts_per_page' => 2, 'cat' => '3', 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), ));?>
  49.  
  50. <?php if (have_posts()) : ?>
  51. <?php while (have_posts()) : the_post(); ?>
  52. <h4 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'cc' ) ?> <?php the_title_attribute(); ?>"> <?php the_title(); ?> </a></h4>
  53.  
  54. <?php endwhile; ?>
  55.  
  56. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', '' ) ); ?></div>
  57. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', '' ) ); ?></div>
  58.  
  59. <?php endif; ?>
  60. <?php wp_reset_query();?>
  61.  
  62.  
  63. <?/*END BASIC QUERY CODE*/?>
  64.  
  65.  
  66. <?php } ?>
  67.  
  68.  
  69.  
  70.  
  71.  
  72. <?php comments_template( '', true ); ?>
  73.  
  74. <?php endwhile; // end of the loop. ?>
  75.  
  76.  
  77.  
  78.  
  79. </div><!-- #content -->
  80. </div><!-- #container -->
  81.  
  82. <?php get_sidebar(); ?>
  83. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement